module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// identity function for calling harmony imports with the correct context
/******/ 	__webpack_require__.i = function(value) { return value; };
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 22);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var NODE_ID = 0; // \u8282\u70b9\u7684\u5168\u5c40ID


function Node(option) {
    option = option || {};
    this.width = option.width || 0;
    this.height = option.height || 0;
    this.x = option.x || 0;
    this.y = option.y || 0;

    this._name = option.name || -1;

    this.childNodes = [];
    this.parentNode = null;
    this.visible = true;

    this.animationClip = {};

    this.zIndex = -1;

    /*\u8282\u70b9\u5728\u70b9\u51fb\u7684\u65f6\u5019\u662f\u5426\u53ef\u7a7f\u900f\uff0c\u9ed8\u8ba4\u4e0d\u53ef\u7a7f\u900f*/
    if (typeof option.through === 'boolean') {
        this.through = option.through;
    } else {
        this.through = false;
    }

    this.dataset = {}; // \u7528\u4e8e\u989d\u5916\u7684\u81ea\u5b9a\u4e49\u4fe1\u606f

    if (typeof option.visible !== 'undefined') {
        this.setVisible(option.visible);
    }
}

Node.prototype.getNODE_ID = function () {
    return NODE_ID++;
};

Node.prototype._addChild = function (node) {
    if (!node.NODE_ID) {
        node.NODE_ID = this.getNODE_ID();
    }
    node.parentNode = this;
    this.computedChildPosition(node);
};

/*\u6dfb\u52a0\u5b50\u5143\u7d20*/
Node.prototype.addChild = function (node) {
    this._addChild(node);
    this.childNodes.push(node);
};

/*\u5220\u9664\u5bf9\u5e94\u7684\u5b50\u5143\u7d20*/
Node.prototype.removeChildByName = function (name) {
    if (typeof name !== 'string') return null;
    for (var i = 0; i < this.childNodes.length; i++) {
        if (this.childNodes[i]._name === name) {
            return this.childNodes.splice(i, 1); // \u79fb\u9664\u5bf9\u5e94\u7684\u5b50\u5143\u7d20
        }
    }
    return null;
};

/*\u901a\u8fc7\u5b50\u5143\u7d20\u540d\u79f0\u83b7\u53d6\u5bf9\u5e94\u7684\u5b50\u5143\u7d20*/
Node.prototype.getChildByName = function (name) {
    if (typeof name !== 'string') return null;
    for (var i = 0; i < this.childNodes.length; i++) {
        if (this.childNodes[i]._name === name) {
            return this.childNodes[i];
        }
    }
    return null;
};

/*\u91cd\u65b0\u8ba1\u7b97\u4f4d\u7f6e\uff0c\u76f8\u5bf9\u4e8e\u7236\u7ea7\u7684\u4f4d\u7f6e*/
Node.prototype.computedChildPosition = function (node) {
    node.x += this.x;
    node.y += this.y;
};

/*\u8bbe\u7f6e\u8282\u70b9\u7684\u663e\u793a*/
Node.prototype.setVisible = function (visible, ignore) {
    this.visible = visible;
    if (!ignore) {
        for (var i = 0; i < this.childNodes.length; i++) {
            this.childNodes[i].setVisible(visible);
        }
    }
};

Node.prototype.setThrough = function (through, ignore) {
    this.through = through;
    if (!ignore) {
        for (var i = 0; i < this.childNodes.length; i++) {
            this.childNodes[i].setThrough(through);
        }
    }
};

Node.prototype.setPosition = function (x, y) {

    x = x || this.x;
    y = y || this.y;

    var dX = this.x - x;
    var dY = this.y - y;

    this.x = x;
    this.y = y;

    /*\u5faa\u73af\u53d8\u66f4\u5b50\u8282\u70b9*/
    for (var i = 0; i < this.childNodes.length; i++) {
        var oX = this.childNodes[i].x;
        var oY = this.childNodes[i].y;
        oX -= dX;
        oY -= dY;
        this.childNodes[i].setPosition(oX, oY);
    }
};

/*\u5185\u90e8\u81ea\u66f4\u65b0\u7cfb\u7edf*/
Node.prototype._update = function () {};

/*\u8282\u70b9\u7684\u66f4\u65b0\u51fd\u6570*/
Node.prototype.update = function () {
    /*\u53ef\u91cd\u5199*/
};

/*\u8282\u70b9\u7684\u7ed8\u5236*/
Node.prototype.draw = function () {
    if (!this.visible) return;
    this._draw();
};

Node.prototype._draw = function () {
    this.childNodes.forEach(function (node) {
        /*\u66f4\u65b0animation*/
        var clip = node.animationClip;
        for (var i in clip) {
            clip[i].update();
        }
        node.visible && node.update(); // \u53ea\u5728\u8282\u70b9\u663e\u793a\u7684\u65f6\u5019\uff0c\u66f4\u65b0
        node.draw && node.draw();
    });
};

Node.prototype.destroy = function (stage) {
    stage.EventManger.destroyEvent(stage); // \u5220\u9664\u6ce8\u518c\u7684\u4e8b\u4ef6
};

// \u4e8b\u4ef6\u7ba1\u7406\u673a\u5236

/*\u6dfb\u52a0\u4e8b\u4ef6*/
Node.prototype.on = function (type, callback) {
    // \u8fdb\u884c\u4e8b\u4ef6\u7684\u6302\u8f7d
    this[type] = callback;
    this[type + '-once'] = false;
};

/*\u79fb\u9664\u4e8b\u4ef6*/
Node.prototype.off = function (type) {
    this['' + type] = null;
};

/*\u6ce8\u518c\u4e00\u6b21\u7684\u4e8b\u4ef6*/
Node.prototype.once = function (type, callback) {
    this.on(type, callback);
    this[type + '-once'] = true; // \u8fdb\u884c\u6807\u8bb0
};

Node.prototype.addAnimationClip = function (name, animationClip, autoplay) {
    if (!this.animationClip[name]) {
        animationClip.init(this);
        this.animationClip[name] = animationClip;
        // \u662f\u5426\u81ea\u52a8\u64ad\u653e
        if (autoplay) {
            this.playAnimationClip(name);
        }
    }
};

Node.prototype.removeAnimationClip = function (name) {
    var clip = this.animationClip[name];
    if (clip) {
        clip.stop();
        delete this.animationClip[name];
    }
};

Node.prototype.playAnimationClip = function (name) {
    if (this.animationClip[name]) {
        this.animationClip[name].start();
    }
};

Node.prototype.getAnimationClip = function (name) {
    if (this.animationClip[name]) {
        return this.animationClip[name];
    }
    return null;
};

module.exports = Node;

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/19 0019.
 */

var OS = {};

OS.onMiniProgram = typeof wx !== 'undefined'; // \u5fae\u4fe1\u5c0f\u7a0b\u5e8f

/*\u7cfb\u7edf\u7684\u4fe1\u606f*/
if (OS.onMiniProgram) {

    OS.onMobile = true;

    try {

        var _wxSystem = wx.getSystemInfoSync();
        OS.width = _wxSystem.windowWidth;
        OS.height = _wxSystem.windowHeight;
        OS.pixelRatio = _wxSystem.pixelRatio;
    } catch (e) {
        OS.pixelRatio = 1;
    }

    try {
        var wxSystem = wx.getSystemInfoSync();

        OS.onMiniProgram = true;
        if (/ios/ig.test(wxSystem.system)) {
            OS.OS = 2; // IOS:2
            OS.onIOS = true;
        } else {
            OS.OS = 1; //
            OS.onAndriod = true;
        }
        /*\u6dfb\u52a0\u50cf\u7d20\u5206\u8fa8\u7387*/
        OS.CLIENT = {
            width: wxSystem.windowWidth * wxSystem.pixelRatio,
            height: wxSystem.windowHeight * wxSystem.pixelRatio,
            pixelRatio: wxSystem.pixelRatio
        };

        OS.isGame = typeof wx.createCanvas !== 'undefined';
    } catch (e) {
        // Do something when catch error
    }
} else {

    var u = navigator.userAgent;

    OS.width = document.documentElement.clientWidth || document.body.clientWidth;
    OS.height = document.documentElement.clientHeight || document.body.clientHeight;
    OS.pixelRatio = window.devicePixelRatio || 1;

    OS.onIOS = !!u.match(/\(i[^;]+;(U;)? CPU.+Mac OS X/);
    OS.onMobile = !!u.match(/AppleWebKit.*Mobile.*/);
    OS.onAndriod = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
}

OS.createCanvas = function () {
    if (OS.onMiniProgram) {
        return wx.createCanvas();
    }
    return document.createElement('canvas');
};

OS.createImage = function () {
    if (OS.onMiniProgram) {
        return wx.createImage();
    }

    return new Image();
};

module.exports = OS;

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*\u53ea\u505a\u7b80\u5355\u7684\u5904\u7406*/

var OS = __webpack_require__(1);
var RES_MAP = {};
var MD5 = __webpack_require__(4);

function Loader(option) {
    option = option || {};
    option.list = option.list || [];
    this.loaded = 0;
    this.loadeLength = option.list.length;
    this.success = option.success;
    this.error = option.error;
    var self = this;
    this.base64Reg = /base64/;
    this.imgReg = /\.(jpg|png)/;

    option.list.forEach(function (url) {
        self.loadFile(url);
    });
    return this;
}

Loader.prototype.loadFileComplete = function () {
    this.loaded++;
    var self = this;
    if (this.loaded === this.loadeLength) {
        setTimeout(function () {
            self.success && self.success();
        }, 20);
    }
};

/*\u52a0\u8f7d\u5355\u4e2a\u6587\u4ef6*/
Loader.prototype.loadFile = function (url) {

    var self = this;
    var isBase64File = this.base64Reg.test(url);

    // \u4f18\u5148\u63d0\u53d6\u7f13\u5b58\u6587\u4ef6
    if (this.getRes(url)) {

        this.loadFileComplete();
    } else {

        if (this.imgReg.test(url) || isBase64File) {
            /*\u6682\u65f6\u53ea\u5904\u7406\u56fe\u7247\u52a0\u8f7d*/
            var image = OS.createImage();
            image.src = url;

            if (!isBase64File) image.crossOrigin = "anonymous";

            image.onload = function () {

                if (isBase64File) {
                    RES_MAP[MD5(url)] = image;
                } else {
                    RES_MAP[url] = image;
                }

                self.loadFileComplete();
            };

            image.onerror = function () {
                console.log('loadFile[fail]:' + url);
                self.error && self.error({ message: 'loadFile[fail]:' + url });
            };
        }

        /*\u52a0\u8f7d\u97f3\u9891\u6587\u4ef6*/
        else if (/\.mp3/.test(url)) {
                if (OS.onMiniProgram) {
                    self.loadFileComplete();
                    return;
                }

                var xhr = new XMLHttpRequest();
                xhr.open('GET', url, true);
                xhr.responseType = 'arraybuffer';
                xhr.onload = function () {
                    self.audioContext.decodeAudioData(xhr.response, function (buffer) {
                        RES_MAP[url] = buffer;
                        self.loadFileComplete();
                    });
                };
                xhr.send();
            }
    }
};

Loader.prototype.getRes = function (url) {

    if (this.base64Reg.test(url)) {
        url = MD5(url);
    }

    if (RES_MAP[url]) {
        return RES_MAP[url];
    }

    return null;
};

module.exports = Loader;

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/7/20 0020.
 */

var encodeURI = function encodeURI() {
    var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";

    return encodeURIComponent(uri);
};

var decodeURI = function decodeURI() {
    var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";

    return decodeURIComponent(uri);
};

module.exports = function () {
    var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

    var paramList = [];
    for (var i in object) {
        if (object.hasOwnProperty(i)) {
            var item = encode ? encodeURI(object[i]) : object[i];
            paramList.push(i + '=' + item);
        }
    }
    return paramList.join('&');
};

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// (function () {
function safeAdd(x, y) {
    var lsw = (x & 0xffff) + (y & 0xffff);
    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
    return msw << 16 | lsw & 0xffff;
}

function bitRotateLeft(num, cnt) {
    return num << cnt | num >>> 32 - cnt;
}

function md5cmn(q, a, b, x, s, t) {
    return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
}

function md5ff(a, b, c, d, x, s, t) {
    return md5cmn(b & c | ~b & d, a, b, x, s, t);
}

function md5gg(a, b, c, d, x, s, t) {
    return md5cmn(b & d | c & ~d, a, b, x, s, t);
}

function md5hh(a, b, c, d, x, s, t) {
    return md5cmn(b ^ c ^ d, a, b, x, s, t);
}

function md5ii(a, b, c, d, x, s, t) {
    return md5cmn(c ^ (b | ~d), a, b, x, s, t);
}

function binlMD5(x, len) {
    /* append padding */
    x[len >> 5] |= 0x80 << len % 32;
    x[(len + 64 >>> 9 << 4) + 14] = len;

    var i;
    var olda;
    var oldb;
    var oldc;
    var oldd;
    var a = 1732584193;
    var b = -271733879;
    var c = -1732584194;
    var d = 271733878;

    for (i = 0; i < x.length; i += 16) {
        olda = a;
        oldb = b;
        oldc = c;
        oldd = d;

        a = md5ff(a, b, c, d, x[i], 7, -680876936);
        d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
        c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
        b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
        a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
        d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
        c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
        b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
        a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
        d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
        c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
        b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
        a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
        d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
        c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
        b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);

        a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
        d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
        c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
        b = md5gg(b, c, d, a, x[i], 20, -373897302);
        a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
        d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
        c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
        b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
        a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
        d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
        c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
        b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
        a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
        d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
        c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
        b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);

        a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
        d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
        c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
        b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
        a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
        d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
        c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
        b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
        a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
        d = md5hh(d, a, b, c, x[i], 11, -358537222);
        c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
        b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
        a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
        d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
        c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
        b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);

        a = md5ii(a, b, c, d, x[i], 6, -198630844);
        d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
        c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
        b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
        a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
        d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
        c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
        b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
        a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
        d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
        c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
        b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
        a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
        d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
        c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
        b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);

        a = safeAdd(a, olda);
        b = safeAdd(b, oldb);
        c = safeAdd(c, oldc);
        d = safeAdd(d, oldd);
    }
    return [a, b, c, d];
}

function binl2rstr(input) {
    var i;
    var output = '';
    var length32 = input.length * 32;
    for (i = 0; i < length32; i += 8) {
        output += String.fromCharCode(input[i >> 5] >>> i % 32 & 0xff);
    }
    return output;
}

function rstr2binl(input) {
    var i;
    var output = [];
    output[(input.length >> 2) - 1] = undefined;
    for (i = 0; i < output.length; i += 1) {
        output[i] = 0;
    }
    var length8 = input.length * 8;
    for (i = 0; i < length8; i += 8) {
        output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;
    }
    return output;
}

function rstrMD5(s) {
    return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
}

function rstrHMACMD5(key, data) {
    var i;
    var bkey = rstr2binl(key);
    var ipad = [];
    var opad = [];
    var hash;
    ipad[15] = opad[15] = undefined;
    if (bkey.length > 16) {
        bkey = binlMD5(bkey, key.length * 8);
    }
    for (i = 0; i < 16; i += 1) {
        ipad[i] = bkey[i] ^ 0x36363636;
        opad[i] = bkey[i] ^ 0x5c5c5c5c;
    }
    hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
    return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
}

function rstr2hex(input) {
    var hexTab = '0123456789abcdef';
    var output = '';
    var x;
    var i;
    for (i = 0; i < input.length; i += 1) {
        x = input.charCodeAt(i);
        output += hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f);
    }
    return output;
}

function str2rstrUTF8(input) {
    return unescape(encodeURIComponent(input));
}

function rawMD5(s) {
    return rstrMD5(str2rstrUTF8(s));
}

function hexMD5(s) {
    return rstr2hex(rawMD5(s));
}

function rawHMACMD5(k, d) {
    return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
}

function hexHMACMD5(k, d) {
    return rstr2hex(rawHMACMD5(k, d));
}

function md5(string, key, raw) {
    if (!key) {
        if (!raw) {
            return hexMD5(string);
        }
        return rawMD5(string);
    }
    if (!raw) {
        return hexHMACMD5(key, string);
    }
    return rawHMACMD5(key, string);
}

module.exports = md5;
// return md5;
// })();

/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Tween = __webpack_require__(21);
var Node = __webpack_require__(0);

function AnimationClip(properties, option) {
    properties = properties || {};
    option = option || {};
    this.properties = properties;
    this.duration = option.duration || 1000;
    this.loop = option.loop;
    this.callback = option.callback;
    this.forwards = option.forwards;
    this.easeType = this.getEaseType(option.easeType);
    this.animateCount = 0;
    this.animate = false;
}

/*\u7ee7\u627fNode\u7684\u539f\u578b\u94fe*/
AnimationClip.prototype = new Node();

/*\u8fdb\u884c\u521d\u59cb\u5316\u64cd\u4f5c*/
AnimationClip.prototype.init = function (target) {
    this.target = target;
    this.saveProperties();
};

/*\u8ba1\u7b97\u66f2\u7ebf\u7684\u51fd\u6570\u7c7b\u578b*/
AnimationClip.prototype.getEaseType = function (type) {
    type = type || '';
    if (type === 'Linear') {
        return ['Linear'];
    }
    var result = ['Quad', 'easeIn'];
    var ease = type.split('.');
    if (Tween[ease[0]]) {
        result[0] = ease[0];
        if (Tween[ease[0]][ease[1]]) {
            result[1] = ease[1];
        }
    }
    return result;
};

/*\u91cd\u65b0\u8bbe\u7f6e\u52a8\u753b\u5c5e\u6027*/
AnimationClip.prototype.setClipValue = function (obj) {
    for (var i in obj) {
        if (obj.hasOwnProperty(i)) {
            this.properties[i] = obj[i];
            this.oProperties[i] = this.target[i];
            this.changeProperties[i] = obj[i] - this.oProperties[i];
        }
    }
};

AnimationClip.prototype.setCallback = function (callback) {
    this.callback = callback;
};

/*\u4fdd\u5b58\u4e4b\u524d\u7684\u5c5e\u6027\u503c*/
AnimationClip.prototype.saveProperties = function () {
    this.oProperties = {};
    this.changeProperties = {};
    for (var i in this.properties) {
        if (this.properties.hasOwnProperty(i)) {
            this.oProperties[i] = this.target[i];
            this.changeProperties[i] = this.properties[i] - this.oProperties[i];
        }
    }
};

/*\u8bfb\u53d6\u4e4b\u524d\u7684\u5c5e\u6027\u503c*/
AnimationClip.prototype.restoreProperties = function () {
    for (var i in this.oProperties) {
        if (this.oProperties.hasOwnProperty(i)) {
            this.setTargetValue(i, this.oProperties[i]);
        }
    }
};

/*\u5f00\u59cb\u52a8\u753b*/
AnimationClip.prototype.start = function () {
    this.stop();
    this.startTime = +new Date();
    this.animate = true;
};

/*\u505c\u6b62\u52a8\u753b*/
AnimationClip.prototype.stop = function () {
    this.animate = false;
    if (!this.forwards) {
        this.restoreProperties(); // \u4fee\u590d\u505c\u6b62\u7684\u6700\u7ec8\u503c
    }
};

/*\u8bbe\u7f6e\u8282\u70b9\u7684\u5c5e\u6027*/
AnimationClip.prototype.setTargetValue = function (key, value) {
    switch (key) {
        case 'x':
            this.target.setPosition(value, null);
            break;
        case 'y':
            this.target.setPosition(null, value);
            break;
        default:
            this.target[i] = value;
    }
};

/*\u66f4\u65b0\u51fd\u6570*/
AnimationClip.prototype.update = function (now) {
    if (!this.animate) return;
    now = now || +new Date();
    var t = now - this.startTime;
    var d = this.duration;

    var hasFinish = t >= d,
        f = false;

    /*\u5355\u6b21\u52a8\u753b\u63cf\u8ff0\u5b8c\u6210\uff0c\u8fdb\u884c\u5224\u65ad\u68c0\u67e5*/
    if (hasFinish) {
        /*\u6b64\u5904\u9700\u8981\u4fee\u590d\u6700\u540e\u4e00\u5e27*/
        for (var i in this.properties) {
            var easingValue = this.properties[i];
            this.setTargetValue(i, easingValue);
        }
        f = this.singleCallback();
        if (f) {
            this.callback && this.callback(); // \u56de\u8c03\u9884\u8bbe\u7684\u56de\u8c03\u51fd\u6570
        }
        return;
    }

    /*\u4f9d\u6b21\u66f4\u6539\u52a8\u753b\u5c5e\u6027\u503c*/
    for (var i in this.properties) {
        var b = this.oProperties[i];
        var c = this.changeProperties[i];

        if (this.easeType.length === 1) {
            var easingValue = Tween[this.easeType[0]](t, b, c, d);
        } else {
            var easingValue = Tween[this.easeType[0]][this.easeType[1]](t, b, c, d);
        }

        this.setTargetValue(i, easingValue);
    }
};

/*\u5355\u6b21\u7684\u52a8\u753b\u56de\u8c03*/
AnimationClip.prototype.singleCallback = function () {
    this.animateCount++;

    if (this.loop) {
        if (this.loop !== -1) {
            if (this.loop === this.animateCount) {
                this.animateCount = 0;
                this.stop();
                return true;
            }
        }

        this.start();
        return false;
    }

    this.animateCount = 0;
    this.stop();
    return true;
};

module.exports = AnimationClip;

/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*\u7b80\u5355\u7684\u77e9\u5f62\u7ed8\u5236\uff08\u5706\u89d2\uff09*/

var Node = __webpack_require__(0);
var Loader = __webpack_require__(2);

module.exports = function (stage) {

    // console.log('FN', stage);

    function React(option) {
        option = option || {};
        Node.call(this, option);

        this.fillStyle = option.fillStyle || '#efefef'; // \u7eaf\u8272\u586b\u5145

        if (option.texture) {
            this.texture = option.texture; // \u6750\u8d28\u8d34\u56fe
        } else if (option.url) {
            this.url = option.url;
            this.loadTexture();
        }

        this.stage = stage;
        this.context = stage.context;

        /*\u5224\u65ad\u662f\u5426\u9700\u8981\u5706\u89d2[A,B,C,D]*/
        // if (option.round) {
        this.round = option.round;
        // }
    }

    React.prototype = new Node();

    React.prototype.loadTexture = function () {

        var self = this;
        var loader = new Loader({
            list: [this.url],
            success: function success(res) {
                var texture = loader.getRes(self.url);
                self.setTexture(texture);
                /*\u901a\u77e5stage\u91cd\u65b0\u7ed8\u5236*/
                self.stage.draw();
            }
        });
    };

    React.prototype.setTexture = function (texture) {
        this.texture = texture;
        // this.width = texture.width;
        // this.height = texture.height;
        // if (this.parentNode && this.parentNode.constructorName === "ListViewItem") {
        //     this.parentNode.computedPosition();  // \u901a\u77e5\u66f4\u65b0\u5c3a\u5bf8
        // }
    };

    React.prototype.draw = function () {
        if (!this.visible) return;
        this.context.save();
        this.context.fillStyle = this.fillStyle;
        if (this.round) {
            this.stage.setRoundClipPath(this.x, this.y, this.width, this.height, this.round);
        }
        this.context.fillRect(this.x, this.y, this.width, this.height);
        this.context.restore();
        this._draw();
    };

    return React;
};

/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/27 0027.
 */

var objectFormat = __webpack_require__(3);

var createXMLHTTPRequest = function createXMLHTTPRequest() {
    var xmlHttpRequest;
    if (window.XMLHttpRequest) {
        xmlHttpRequest = new XMLHttpRequest();
        if (xmlHttpRequest.overrideMimeType) {
            xmlHttpRequest.overrideMimeType("text/xml");
        }
    } else if (window.ActiveXObject) {
        var activexName = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
        for (var i = 0; i < activexName.length; i++) {
            try {
                xmlHttpRequest = new ActiveXObject(activexName[i]);
                if (xmlHttpRequest) {
                    break;
                }
            } catch (e) {}
        }
    }
    return xmlHttpRequest;
};

module.exports = function () {
    var app = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};


    var addDefaultParam = function addDefaultParam(query, data) {

        // url - key
        var params = [['sdwrfid', 'rfid'], ['sdwfrom', 'from']];

        params.forEach(function (item) {
            if (query[item[0]]) {
                data[item[1]] = query[item[0]];
            }
        });
    };

    /*\u5fae\u4fe1\u7684\u8bf7\u6c42\u65b9\u6cd5*/
    var wxRequest = function wxRequest(type, url, data, callback) {

        // \u83b7\u53d6\u6e20\u9053\u503c
        data.channel = app.getChannel();

        /*\u6dfb\u52a0\u53d1\u9001\u8005ID*/
        if (app.isGame) {
            if (app._wx_launchs && app._wx_launchs.query) {
                addDefaultParam(app._wx_launchs.query, data);
            }
        } else {
            var _app = getApp();
            if (_app && _app.getLaunch()) {
                var launch = _app.getLaunch().query;
                var userInfo = _app.userInfo;
                if (userInfo && userInfo.fl) {
                    data.fl = userInfo.fl;
                }
                addDefaultParam(launch, data);
            }
        }

        wx.request({
            url: url,
            method: type || 'GET',
            data: data,
            header: {
                'content-type': 'application/json' // \u9ed8\u8ba4\u503c
            },
            dataType: 'json',
            success: function success(res) {
                res = res || {};
                callback && callback(res.data || {
                    msg: "[success]data\u6570\u636e\u83b7\u53d6\u5931\u8d25"
                });
            },
            fail: function fail(res) {
                res = res || {};
                callback && callback(res.data || {
                    msg: "[fail]data\u6570\u636e\u83b7\u53d6\u5931\u8d25"
                });
            }
        });
    };

    /*\u7f51\u9875\u7684\u8bf7\u6c42*/
    var webRequest = function webRequest() {
        var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'GET';
        var url = arguments[1];
        var data = arguments[2];
        var callback = arguments[3];


        if (!url) return console.log('[URL]\u4e0d\u80fd\u4e3a\u7a7a');

        /*\u6dfb\u52a0\u7edf\u8ba1\u5b57\u6bb5  ?sdwchannel=1*/
        data.channel = app.getChannel();

        var req = createXMLHTTPRequest();
        if (type === 'GET') {
            if (data) {
                if (url.indexOf('?') !== -1) {
                    url += '&' + objectFormat(data);
                } else {
                    url += '?' + objectFormat(data);
                }
            }
            req.open(type, url, true);
            req.send(null);
        } else if (type === 'POST') {
            req.open(type, url);
            req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            // \u53d1\u9001
            req.send(objectFormat(data));
        }

        req.onerror = function () {
            callback && callback({ msg: '[Ajax Error]\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u63a5\u53e3' });
        };
        req.onreadystatechange = function () {
            if (req.readyState === 4 && req.status === 200) {
                var resData = JSON.parse(req.responseText);
                callback && callback(resData);
            }
        };
    };

    app.getData = function () {
        var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};

        if (app.isMiniProgram) {
            wxRequest('GET', url, data, callback);
        } else {
            webRequest('GET', url, data, callback);
        }
    };

    app.postData = function () {
        var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
        var type = arguments[3];

        if (app.isMiniProgram) {
            wxRequest('POST', url, data, callback);
        } else {
            webRequest('POST', url, data, callback);
        }
    };
};

/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/27 0027.
 *
 * \u652f\u4ed8\u6a21\u5757\uff0c\u4f9d\u8d56\uff1a
 *
 * payment-qrcode\uff08\u79bb\u5c4fcanvas\uff09
 *
 */

// var Payment = require('./payment-qrcode');  // \u76f4\u63a5\u91c7\u7528\u8df3\u8f6c\u4e86\uff0c\u4e0d\u4f7f\u7528\u4e8c\u7ef4\u7801

/*app \u662fsdk\u7684\u5b9e\u4f8b\u5bf9\u8c61*/
module.exports = function (app) {

    // const paymentCode = Payment(app);

    /*\u5fae\u4fe1\u5c0f\u6e38\u620f--\u5b89\u5353--\u865a\u62df\u652f\u4ed8*/
    var Midas_Pay = function Midas_Pay(option, isTest) {

        wx.showLoading({ title: '\u8bf7\u6c42\u4e2d\uff0c\u8bf7\u7a0d\u540e' });

        var userInfo = app._USER_INFO;

        var postPayData = {
            openid: userInfo.openid ? userInfo.openid : "",
            sessionkey: userInfo.session_key ? userInfo.session_key : "",
            pf: 'android',
            amt: option.amount,
            pay_item: option.subject,
            zone_id: option.zoneId || '1',
            // rate: option.rate,
            memo: JSON.stringify({
                accountId: option.accountId,
                amount: option.amount,
                appId: option.appId,
                cpOrderId: option.cpOrderId,
                call_back_url: option.call_back_url,
                merchant_url: option.merchant_url,
                subject: option.subject,
                timestamp: option.timestamp,
                sign: option.sign,
                memo: option.memo || ""
            })
        };

        if (option.isPay) {
            postPayData.isPay = 1;
        } else {
            postPayData.isPay = 0;
        }

        // var PAY_URL = 'https://hsdk.notify.17m3.com';  // \u6b63\u5f0f\u7684\u5730\u5740
        // var PAY_URL = 'https://sandbox-hsdk-pay-notify.17m3.com'; // \u6d4b\u8bd5\u5730\u5740

        // var PAY_URL = isTest ? 'https://sandbox-hsdk-pay-notify.17m3.com' : 'https://hsdk.notify.17m3.com';

        var PAY_URL = isTest ? 'https://sandbox-hsdk-pay-notify.17m3.com' : 'https://hsdk-pay-notify.17m3.com';
        var payUrl = PAY_URL + "/NotifyCallBack/" + option.appId + "/1398_" + option.channel;

        console.log('postPayData', postPayData);
        // console.log('payUrl', payUrl);

        app.postData(payUrl, postPayData, function (res) {

            // console.log('Midas_Pay:', res);

            wx.hideLoading();

            if (res.ret == 0) {
                wx.showToast({
                    title: "\u652f\u4ed8\u6210\u529f\uff01",
                    icon: 'success',
                    duration: 2000
                });
                option.success && option.success(option);
                option.complete && option.complete({
                    cpOrderId: option.cpOrderId
                });
            } else if (res.ret == 1) {
                plt_Pay(res.data, option, isTest); // \u4f59\u989d\u4e0d\u8db3\uff0c\u524d\u7aef\u7c73\u5927\u5e08\u652f\u4ed8
            } else {
                wx.showToast({
                    title: res.message || JSON.stringify(res),
                    duration: 2000
                });
                option.fail && option.fail({
                    msg: res.message
                });
                option.complete && option.complete({
                    cpOrderId: option.cpOrderId
                });
            }
        });
    };

    var plt_Pay = function plt_Pay(data, option, isTest) {

        wx.requestMidasPayment({
            mode: 'game',
            offerId: data.offer_id,
            buyQuantity: option.amount / 100 * data.rate, // \u9700\u8981\u4e00\u4e2a\u5355\u4ef7\u6765\u505a\u6362\u7b97 buyQuantity * \u6e38\u620f\u5e01\u5355\u4ef7 = \u652f\u4ed8RMB
            env: isTest ? 1 : 0,
            currencyType: 'CNY',
            platform: 'android',
            zoneId: option.zoneId || '1',
            success: function success() {
                // \u652f\u4ed8\u6210\u529f\uff0c\u91cd\u65b0\u53d1\u8d77\u652f\u4ed8
                console.log('requestMidasPayment success');
                wx.showLoading({ title: '\u8bf7\u7a0d\u540e...' });
                option.isPay = 1; // \u65b0\u589e\u652f\u4ed8\u8bc6\u522b\u5b57\u6bb5
                chooseSDWPay(option, _IOSCONFIG, _ISTEST);
            },
            fail: function fail(_ref) {
                var errMsg = _ref.errMsg,
                    errCode = _ref.errCode;

                console.log('requestMidasPayment fail');
                console.log(errMsg, errCode);
                wx.showToast({
                    title: errMsg,
                    duration: 2000
                });
                option.fail && option.fail({
                    msg: "\u652f\u4ed8\u5931\u8d25",
                    errMsg: errMsg,
                    errCode: errCode
                });
            },

            complete: function complete() {}
        });
    };
    /*\u5fae\u4fe1\u5c0f\u6e38\u620f--\u5b89\u5353--\u865a\u62df\u652f\u4ed8*/

    /*\u5fae\u4fe1\u5c0f\u6e38\u620f--IOS--\u8bf7\u6c42\u5c0f\u7a0b\u5e8f\u4e8c\u7ef4\u7801*/
    var IOS_PAY_QR_CODE = function IOS_PAY_QR_CODE(option, iosConfig) {

        wx.showLoading({ title: '\u8bf7\u6c42\u4e2d\uff0c\u8bf7\u7a0d\u540e' });

        // option.page = 'pages/indexS/indexS';  // \u5c0f\u7a0b\u5e8f\u7684\u652f\u4ed8\u754c\u9762
        // option.width = 320;

        option.hasQrcode = 0; // 0:\u4e0d\u9700\u8981\u4e8c\u7ef4\u7801\u30021\uff1a\u9700\u8981\u4e8c\u7ef4\u7801

        /*\u6362\u53d6\u5c0f\u7a0b\u5e8f\u4e8c\u7ef4\u7801*/
        app.postData('https://wxpush.shandw.com/miniproacode/wxdc1767838b33cbdb', option, function (data) {

            wx.hideLoading();

            if (data.result === 1) {

                // var qrCodeData = 'data:image/png;base64,' + data.qrcode;  // \u83b7\u53d6base64\u7684\u6570\u636e
                // qrCodeData = qrCodeData.replace(/[\r\n]/g, "");  // \u53bb\u9664\u6362\u884c\u7b49
                // new paymentCode(iosConfig, option, qrCodeData);  // \u6267\u884c

                // flag [2018-09-06 10:54:54] \u8df3\u8f6c\u5c0f\u7a0b\u5e8f
                if (data.scene) {
                    app.goToSdw({
                        path: 'pages/pay/pay?payToken=' + data.scene
                        // envVersion: 'develop'
                    });
                } else {
                    wx.showToast({
                        title: '\u652f\u4ed8\u6570\u636e\u8f6c\u6362\u5931\u8d25',
                        duration: 2000
                    });
                    option.fail && option.fail({
                        result: 0,
                        msg: '\u652f\u4ed8\u6570\u636e\u8f6c\u6362\u5931\u8d25'
                    });
                    option.complete && option.complete({
                        cpOrderId: option.cpOrderId
                    });
                }
            }
        });
    };

    var _IOSCONFIG = '',
        _ISTEST = '',
        CP_ORDER_ID = null,
        _OPTION = null; // CP\u5b9a\u4e49\u7684\u53c2\u6570

    /*\u66b4\u9732\u7684\u51fd\u6570\u65b9\u6cd5*/
    var chooseSDWPay = function chooseSDWPay() {
        var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        var iosConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var isTest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
        var usePlt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;


        _IOSCONFIG = iosConfig;
        _ISTEST = isTest;

        /*\u5fae\u4fe1\u5c0f\u6e38\u620f\u73af\u5883*/
        if (app.onMiniProgram) {

            // IOS--\u5c0f\u6e38\u620f --> \u6362\u53d6\u652f\u4ed8token --> \u8df3\u8f6c\u5c0f\u7a0b\u5e8f --> \u8fd8\u539ftoken\u6570\u636e  --> \u6362\u53d6\u652f\u4ed8\u6570\u636e ---> \u8c03\u7528\u5fae\u4fe1\u652f\u4ed8
            if (app.wxSystem.OS === 2 || usePlt) {
                IOS_PAY_QR_CODE(option, iosConfig);
                _OPTION = option;
                CP_ORDER_ID = option.cpOrderId; // \u4fdd\u5b58CP\u7684\u8ba2\u5355\u6570\u636e
            }

            // \u5b89\u5353--\u5c0f\u6e38\u620f --> \u6362\u53d6\u652f\u4ed8\u6570\u636e --> \u7c73\u5927\u5e08\u865a\u62df\u652f\u4ed8\u529f\u80fd
            else {
                    Midas_Pay(option, isTest);
                }
        }

        /*H5\u73af\u5883*/
        else {
                app.use_H5_sdw('chooseSDWPay', option); // \u5c1d\u8bd5\u4f7f\u7528\u517c\u5bb9\u73af\u5883
            }
    };

    /*IOS\u652f\u4ed8*/
    wx.onShow(function (res) {
        // console.log('CP_ORDER_ID', CP_ORDER_ID);
        if (CP_ORDER_ID) {
            if (_OPTION) {
                _OPTION.complete && _OPTION.complete({
                    cpOrderId: CP_ORDER_ID
                });
            }
            CP_ORDER_ID = null;
        }
    });

    return chooseSDWPay;
};

/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/27 0027.
 * \u6392\u884c\u699c\u76f8\u5173\u7684\u63a5\u53e3
 */

module.exports = function (app) {

    /**
     * \u4e0a\u62a5\u6392\u884c\u6570\u636e
     * @param option
     */
    app.postRankInfo = function () {
        var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

        var data = {};

        if (!option.id) {
            return console.log('\u7f3a\u5c11\u6392\u884c\u699c\u7684ID');
        }

        if (!option.value) {
            return console.log('\u7f3a\u5c11\u6e38\u620f\u6570\u503c');
        }

        if (app._USER_INFO) {
            data.id = option.id;
            data.appid = app.getAppId();
            data.value = option.value;
            data.uid = app._USER_INFO.uid;
            data.openid = app._USER_INFO.openid || data.uid;
            data.nick = app._USER_INFO.nick || data.uid;
            data.avatar = app._USER_INFO.avatar || '';
            data.sec = +new Date();
            data.sign = app.md5('' + data.id + data.appid + data.value + data.openid + data.uid + data.sec + app._USER_INFO.otoken);
            // \u53d1\u9001\u8bf7\u6c42
            app.getData(app.HTTP_PLATFORM_STATIC + 'rankup', data, function (res) {
                if (res.result === 1) {
                    option.success && option.success(res);
                } else {
                    option.fail && option.fail(res);
                }
            });
        }
    };

    /**
     * \u83b7\u53d6\u6e38\u620f\u7684\u699c\u5355\u6570\u636e
     * @param option
     */
    app.getRankInfo = function () {
        var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};


        if (!option.id) {
            return console.log('\u7f3a\u5c11\u6392\u884c\u699c\u7684ID');
        }
        var data = {
            id: option.id, // \u6392\u884c\u699c\u7684ID
            appid: app.getAppId(),
            bef: option.bef || false,
            page: option.page || 0
        };
        if (app._USER_INFO) {
            data.uid = app._USER_INFO.uid;
            data.openid = app._USER_INFO.openid || data.uid;
            data.sec = app._USER_INFO.secheme;
            data.sign = app.md5('' + data.id + data.appid + data.openid + data.uid + data.sec + app._USER_INFO.otoken);
            // \u5f00\u59cb\u8bf7\u6c42
            app.getData(app.HTTP_PLATFORM_STATIC + 'ranklist', data, function (res) {
                if (res.result === 1) {
                    option.success && option.success(res);
                } else {
                    option.fail && option.fail(res);
                }
            });
        }
    };

    /*\u83b7\u53d6\u5bf9\u6218\u6e38\u620f\u7684\u6392\u884c\u6570\u636e*/
    app.getTinyRankInfo = function () {
        var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};


        var data = {
            appid: app.getAppId(),
            page: option.page || 0,
            type: option.type || 0
        };

        if (app._USER_INFO) {
            data.uid = app._USER_INFO.uid;
            data.openid = app._USER_INFO.openid || data.uid;
            data.token = app._USER_INFO.token;
            data.sec = app._USER_INFO.secheme;
            data.sign = app.md5('' + data.appid + data.openid + data.uid + data.sec + app._USER_INFO.otoken);
            // \u5f00\u59cb\u8bf7\u6c42
            app.getData(app.HTTP_PLATFORM_STATIC + 'tinyrank', data, function (res) {
                if (res.result === 1) {
                    option.success && option.success(res);
                } else {
                    option.fail && option.fail(res);
                }
            });
        } else {

            option.fail && option.fail({ msg: "\u8bf7\u5148\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u540e\u8c03\u7528" });
        }
    };
};

/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/8 0008.
 * \u95ea\u7535\u73a9\u5173\u6ce8\u516c\u4f17\u53f7\u63a5\u53e3
 */

var CanvasStage = __webpack_require__(13);

/*\u5f39\u7a97\u5e7f\u544a*/
function sdwAd(app) {
    /*app\u5bf9\u8c61\u662fSDK\uff0c\u6b64\u5904\u7528\u4f5c\u4fdd\u5b58*/
    // console.log(app);
    /*\u5fae\u4fe1\u4e8c\u7ef4\u7801\u6587\u4ef6\u4e0b\u8f7d\u7ba1\u7406*/
    var qr_code_manger = {
        _map: {},
        getFile: function getFile(option) {
            option = option || {};
            var _self = this;

            if (_self._map[option.url]) {
                option.success && option.success(option.url);
                return;
            }

            wx.downloadFile({
                url: option.url,
                success: function success(res) {
                    _self._map[option.url] = res.tempFilePath;
                    option.success && option.success(res.tempFilePath);
                }, fail: function fail(res) {
                    option.fail && option.fail(res);
                }
            });
        }
    };

    return function (option) {

        option = option || {};

        /*\u9650\u5236\u4f7f\u7528\u7684\u73af\u5883*/
        if (!app.onMiniProgram) {
            option.fail && option.fail({ msg: "\u6b21\u5173\u6ce8\u516c\u4f17\u53f7\u7684\u4fe1\u606f\uff0c\u53ea\u5728\u5c0f\u6e38\u620f\u73af\u5883\u4e2d\u4f7f\u7528\u54e6" });
            return;
        }

        var gWidth = option.width;
        var gHeight = option.height; // \u5168\u5c4f

        var self = this;
        var adInfo = {
            preLoadList: ['http://www.shandw.com/m/wx/finger-icon.png', 'http://www.shandw.com/m/wx/finger-icon2.png', 'http://www.shandw.com/m/wx/save-code.png']
        },
            stage,
            defaultView,
            QrCodeView;

        var BASE_WIDTH = option.landscape ? 1334 : 750; // \u5e73\u53f0\u7684\u8bbe\u8ba1\u7a3f\u5c3a\u5bf8

        /*\u521d\u59cb\u5316\u4e00\u4e2a\u753b\u5e03\u5bf9\u8c61*/
        stage = new CanvasStage({
            width: gWidth,
            height: gHeight,
            scale: option.width / BASE_WIDTH,
            name: 'sdw-ad',
            autoRefresh: false, // \u8bb0\u5f97\u4e3b\u52a8\u8c03\u7528draw!!
            scaleRatio: BASE_WIDTH / (app.CLIENT.width / app.CLIENT.pixelRatio),
            update: function update() {
                if (self.CP_CALL) {
                    self.showAD();
                }
            }
        });
        stage.setVisible(false, true); // \u9690\u85cf\u753b\u5e03

        function StageCallback() {
            self._created = true;

            option.create && option.create({
                width: stage.width,
                height: stage.height,
                flag: adInfo.flag,
                adInfo: adInfo // \u5e7f\u544a\u7684\u6570\u636e\u4fe1\u606f
            }); // \u521d\u59cb\u5316\u64cd\u4f5c

            if (self._createdCallback) {
                self._createdCallback = false;
                self.showAD();
            }
        }

        function initStage(gWidth, gHeight, option, self) {

            var RADIUS = 28;

            /*\u5982\u679c\u4e0d\u5b58\u5728show\u7684\u56de\u8c03\u51fd\u6570\uff0c\u4e0d\u8fdb\u884c\u6e32\u67d3*/
            if (!option.show) {
                console.log('\u521d\u59cb\u5316option.show\u6ca1\u6709\u5b9a\u4e49');
                StageCallback();
                return;
            }

            /*\u52a0\u8f7d\u8d44\u6e90*/
            var loader = new stage.Loader({
                list: adInfo.preLoadList,
                success: function success() {
                    option.landscape ? startDrawDefaultViewLandscape() : startDrawDefaultView(); //
                    drawQrCodeView();
                    switchView();
                    StageCallback(); // \u56de\u8c03\u51fd\u6570
                }

                // fail: function () {
                //     option.fail && option.fail({msg: 'loader error'})
                // }
            });

            /*\u7ed8\u5236\u521d\u59cb\u7684\u5e7f\u544a\u6837\u5f0f\u5c42 \u6a2a\u5c4f*/
            var startDrawDefaultViewLandscape = function startDrawDefaultViewLandscape() {
                defaultView = new stage.Node();
                defaultView.setVisible(false);
                stage.addChild(defaultView);
                // \u80cc\u666f
                var bg = new stage.React({
                    fillStyle: 'rgba(0,0,0,.8)',
                    width: gWidth,
                    height: gHeight,
                    x: 0,
                    y: 0
                });
                defaultView.addChild(bg);

                var container = new stage.React({
                    width: 1150,
                    // height: 826 + 130,
                    fillStyle: 'rgba(0,0,0,0)',
                    x: (BASE_WIDTH - 1150) / 2, // \u6574\u4f53\u5c45\u4e2d
                    y: 173 / stage.scale, // \u9700\u8981\u505a\u5b9a\u4f4d\u64cd\u4f5c
                    round: [RADIUS, RADIUS, 0, 0]
                });
                defaultView.addChild(container);

                /*\u9876\u90e8\u7684\u6d88\u606f*/
                var topReact = new stage.React({
                    fillStyle: '#ff944c',
                    width: 1150,
                    height: 100,
                    x: 0,
                    y: 0,
                    round: [RADIUS, RADIUS, 0, 0]
                });
                container.addChild(topReact);

                /*\u6dfb\u52a0\u6587\u5b57\u4fe1\u606f*/
                var txt = '\u5173\u6ce8\u3010' + adInfo.publicName + '\u3011\u516c\u4f17\u53f7';
                var text1 = new stage.Font({
                    text: txt,
                    fillStyle: '#ffffff',
                    font: '30px Arail',
                    fontSize: 30,
                    x: 30,
                    y: 30
                });

                topReact.addChild(text1);

                var text2 = new stage.Font({
                    text: '\u53d1\u73b0\u66f4\u591a\u7684\u5c0f\u6e38\u620f',
                    fillStyle: '#ffffff',
                    font: '24px Arail',
                    fontSize: 24,
                    x: 30 + txt.length * 30 + 40, // \u5927\u81f4\u8ba1\u7b97\u4e00\u4e0b\u957f\u5ea6
                    y: 35
                });
                topReact.addChild(text2);

                var finger = new stage.Sprite({
                    texture: loader.getRes('http://www.shandw.com/m/wx/finger-icon2.png'),
                    x: 1150 - 20 - 71,
                    y: -63
                });
                topReact.addChild(finger);

                /*\u6dfb\u52a0\u56fe\u7247\u5217\u8868*/
                var listView = new stage.ListView({
                    width: 1150,
                    // height: 820,
                    padding: [0, 0, 30, 0],
                    x: 0,
                    y: 100,
                    background: '#ffffff'
                });
                container.addChild(listView);

                for (var i = 0; i < adInfo.BannerList.length; i++) {
                    drawAdBannerItem(listView, adInfo.BannerList[i], { width: 480, height: 160 });
                }

                /*\u5e95\u90e8\u7684\u5f15\u5bfc\u56fe\u7247*/
                if (adInfo.atStep) {
                    var stepBanner = loader.getRes(adInfo.atStep);
                    var stepBannerItem = new stage.Sprite({
                        width: stepBanner.width,
                        height: stepBanner.height,
                        x: 545,
                        y: 150,
                        texture: stepBanner
                    });
                    container.addChild(stepBannerItem);
                }

                bg.on(bg, 'tap', function (e) {
                    self.hiddenAD();
                });
            };

            /*\u7ed8\u5236\u521d\u59cb\u7684\u5e7f\u544a\u6837\u5f0f\u5c42 \u7ad6\u5c4f*/
            var startDrawDefaultView = function startDrawDefaultView() {

                defaultView = new stage.Node();
                defaultView.setVisible(false);
                stage.addChild(defaultView);

                // \u900f\u660e\u80cc\u666f
                var bg = new stage.React({
                    fillStyle: 'rgba(0,0,0,.8)',
                    width: gWidth,
                    height: gHeight,
                    x: 0,
                    y: 0
                });
                defaultView.addChild(bg);

                var TOP_HEIGHT = app.CLIENT.height / app.CLIENT.width < 18 / 9 ? 250 : 350;

                var container = new stage.React({
                    width: 640,
                    // height: 826 + 130,
                    fillStyle: 'rgba(0,0,0,0)',
                    x: (BASE_WIDTH - 640) / 2, // \u6574\u4f53\u5c45\u4e2d
                    y: TOP_HEIGHT / stage.scale, // \u9700\u8981\u505a\u5b9a\u4f4d\u64cd\u4f5c
                    round: [RADIUS, RADIUS, 0, 0]
                });
                defaultView.addChild(container);

                /*\u9876\u90e8\u7684\u6d88\u606f*/
                var topReact = new stage.React({
                    fillStyle: '#ff944c',
                    width: 640,
                    height: 130,
                    x: 0,
                    y: 0,
                    round: [RADIUS, RADIUS, 0, 0]
                });
                container.addChild(topReact);

                /*\u6dfb\u52a0\u6587\u5b57\u4fe1\u606f*/
                var text1 = new stage.Font({
                    text: '\u5173\u6ce8\u3010' + adInfo.publicName + '\u3011\u516c\u4f17\u53f7',
                    fillStyle: '#ffffff',
                    font: '30px Arail',
                    fontSize: 30,
                    x: 30,
                    y: 30
                });

                topReact.addChild(text1);
                var text2 = new stage.Font({
                    text: '\u53d1\u73b0\u66f4\u591a\u7684\u5c0f\u6e38\u620f',
                    fillStyle: '#ffffff',
                    font: '24px Arail',
                    fontSize: 24,
                    x: 30,
                    y: 75
                });
                topReact.addChild(text2);

                /*\u6dfb\u52a0\u624b\u6307\u56fe\u6807*/
                var finger = new stage.Sprite({
                    texture: loader.getRes('http://www.shandw.com/m/wx/finger-icon.png'),
                    x: 520,
                    y: -74
                });
                topReact.addChild(finger);

                /*\u6dfb\u52a0\u56fe\u7247\u5217\u8868*/
                var listView = new stage.ListView({
                    width: 640,
                    // height: 820,
                    padding: [0, 0, 30, 0],
                    x: 0,
                    y: 130,
                    background: '#ffffff'
                });
                container.addChild(listView);

                for (var i = 0; i < adInfo.BannerList.length; i++) {
                    drawAdBannerItem(listView, adInfo.BannerList[i]);
                }

                /*\u5e95\u90e8\u7684\u5f15\u5bfc\u56fe\u7247*/
                if (adInfo.atStep) {

                    var stepBanner = loader.getRes(adInfo.atStep);
                    var scale = 640 / stepBanner.width;
                    var stepBannerItem = new stage.ListViewItem({
                        margin: [30, 30, 0, 30],
                        width: stepBanner.width * scale,
                        height: stepBanner.height * scale
                    });

                    listView.addChild(stepBannerItem);

                    stepBannerItem.addChild(new stage.Sprite({
                        texture: stepBanner
                        // url: adInfo.atStep,
                    }));
                }

                /**************************\u6dfb\u52a0\u4e8b\u4ef6**************************/
                /*\u76ee\u524d\u6ca1\u6709\u505a\u5c42\u7ea7\u7684\u5224\u65ad\uff0c\u5148\u6dfb\u52a0\u7684\u9ed8\u8ba4\u6700\u5148\u89e6\u53d1*/
                bg.on('tap', function (e) {
                    self.hiddenAD();
                });
            };

            /*\u5355\u5f20\u5e7f\u544a\u56fe*/
            var drawAdBannerItem = function drawAdBannerItem(listView, data, option) {

                option = option || {};
                var listItem = new stage.ListViewItem({
                    margin: [30, 30, 0, 30], // \u5916\u8fb9\u8ddd
                    width: option.width || 580,
                    height: option.height || 196
                });
                listView.addChild(listItem);

                var r = 16;
                var cont = new stage.Sprite({
                    width: option.width || 580,
                    height: option.height || 196,
                    round: [r, r, r, r],
                    drawType: "round",
                    url: data.img || null
                });

                listItem.addChild(cont);

                listItem.dataset.bannerInfo = data; // \u4fdd\u5b58\u989d\u5916\u7684\u4fe1\u606f

                cont.on('tap', function (e) {
                    /*\u6839\u636e\u70b9\u4e2d\u7684\u56fe\u7247\uff0c\u663e\u793a\u4e0d\u540c\u7684\u4e8c\u7ef4\u7801*/
                    var qCode = QrCodeView.getChildByName('qr-container').getChildByName('qr-img'); // \u83b7\u53d6\u4e8c\u7ef4\u7801\u7684\u56fe\u7247
                    if (qCode) {
                        qCode.setUrl(listItem.dataset.bannerInfo.qrcode, { width: 268, height: 268 });
                    }
                    switchView('QrCodeView'); // \u663e\u793a\u4e8c\u7ef4\u7801\u56fe\u5c42
                });

                return listItem;
            };

            /*\u7ed8\u5236\u5e7f\u544a\u5f39\u7a97\u5c42*/
            var drawQrCodeView = function drawQrCodeView() {

                QrCodeView = new stage.Node();
                QrCodeView.setVisible(false);

                stage.addChild(QrCodeView);

                // \u80cc\u666f\u906e\u7f69\u5c42
                var bg = new stage.React({
                    fillStyle: 'rgba(0,0,0,.8)',
                    width: gWidth,
                    height: gHeight,
                    x: 0,
                    y: 0
                });
                QrCodeView.addChild(bg);

                /*\u4e8c\u7ef4\u7801\u7684\u906e\u7f69\u5c42*/
                var container = new stage.React({
                    fillStyle: '#ffffff',
                    width: 640,
                    height: 640,
                    x: (BASE_WIDTH - 640) / 2,
                    y: stage.getStageCenterPosition(640), // \u5c45\u4e2d\u5751\u7239\u4e86
                    round: [RADIUS, RADIUS, RADIUS, RADIUS],
                    name: "qr-container"
                });
                QrCodeView.addChild(container);

                /*\u6dfb\u52a0\u4e8c\u7ef4\u7801\u7684\u56fe\u7247*/
                var qrImg = new stage.Sprite({
                    x: (640 - 268) / 2,
                    y: 100,
                    name: 'qr-img'
                });
                container.addChild(qrImg);

                /*\u6dfb\u52a0\u6587\u5b57\u4fe1\u606f*/
                var text = new stage.Font({
                    text: '\u4fdd\u5b58\u4e8c\u7ef4\u7801\u968f\u65f6\u73a9',
                    fillStyle: '#6a6a6a',
                    font: '28px Arail',
                    fontSize: 28,
                    textAlign: "center",
                    x: 320,
                    y: 415
                });
                container.addChild(text);

                /*\u6dfb\u52a0\u4fdd\u5b58\u56fe\u7247\u7684\u6309\u94ae*/
                var saveButton = new stage.Sprite({
                    texture: loader.getRes('http://www.shandw.com/m/wx/save-code.png'),
                    x: 128,
                    y: 495
                });
                container.addChild(saveButton);

                /*\u6dfb\u52a0\u4e8b\u4ef6*/
                saveButton.on('tap', function (e) {

                    wx.showLoading({
                        title: "\u4e8c\u7ef4\u7801\u6b63\u5728\u4fdd\u5b58\u4e2d",
                        mask: true
                    });

                    /*\u4e0b\u8f7d\u4e8c\u7ef4\u7801*/
                    qr_code_manger.getFile({
                        url: qrImg.url, // \u8bfb\u53d6\u5f53\u524d\u7684\u4e8c\u7ef4\u7801
                        success: function success(filePath) {
                            /*\u4fdd\u5b58\u56fe\u7247*/
                            wx.saveImageToPhotosAlbum({
                                filePath: filePath,
                                success: function success() {
                                    wx.showToast({
                                        title: "\u4fdd\u5b58\u56fe\u7247\u6210\u529f",
                                        icon: 'success',
                                        duration: 2000
                                    });
                                }, fail: function fail() {
                                    wx.showToast({
                                        title: "\u4fdd\u5b58\u56fe\u7247\u5931\u8d25",
                                        duration: 2000
                                    });
                                }
                            });
                        }, fail: function fail(res) {
                            wx.showToast({
                                title: "\u83b7\u53d6\u56fe\u7247\u5931\u8d25",
                                duration: 2000
                            });
                        }
                    });
                });
                // }

                bg.on('tap', function (e) {
                    switchView(); // \u663e\u793a\u9ed8\u8ba4\u7684
                });
            };

            var switchView = function switchView(type) {
                if (type === "QrCodeView") {
                    QrCodeView && QrCodeView.setVisible(true);
                    defaultView && defaultView.setVisible(false);
                } else {
                    QrCodeView && QrCodeView.setVisible(false);
                    defaultView && defaultView.setVisible(true);
                }
                stage.draw(); // \u91cd\u65b0\u7ed8\u5236
            };
        }

        this._created = false;
        this._createdCallback = null;

        this.showAD = function () {
            this.CP_CALL = true;
            if (this._created) {
                if (stage) {
                    stage.setVisible(true, true); // \u53ea\u663e\u793a\u4e3b\u5c4f\u5e55
                    // stage.draw();
                    console.log('showAD', stage);
                    // stage.draw();
                }
                // console.log('stage.canvas[show]', stage.canvas);
                option.show && option.show(stage.canvas);
            } else if (option.show) {
                this._createdCallback = true;
            }
        };

        this.hiddenAD = function () {
            stage && stage.setVisible(false, true);
            option.hidden && option.hidden({
                type: 'sdwAd'
            });
        };

        /*\u6821\u9a8c\u7528\u6237\u7684\u4fe1\u606f*/
        if (app.checkState === 2 && app._USER_INFO) {
            app.getSdwAdInfo(option.id || app.getAppId(), function (res) {
                adInfo.flag = res.flag; // \u662f\u5426\u5173\u6ce8\u7684\u5b57\u6bb5
                adInfo.publicName = res.publicName || '\u95ea\u7535\u73a9'; // \u5173\u6ce8\u516c\u4f17\u53f7\u7684\u540d\u79f0
                adInfo.BannerList = res.list || [];
                if (res.atStep) {
                    adInfo.atStep = res.atStep;
                    adInfo.preLoadList.push(res.atStep);
                }
                initStage(gWidth, gHeight, option, self);
            }, function (res) {
                option.fail && option.fail(res);
            });
        } else {
            option.fail && option.fail({ msg: "\u8bf7\u5148\u83b7\u53d6\u7528\u6237\u4fe1\u606f\uff0c\u7136\u540e\u518d\u521b\u5efa\u5173\u6ce8\u4fe1\u606f" });
        }
    };
}

module.exports = sdwAd;

/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Loader = __webpack_require__(2);
var OS = __webpack_require__(1);

function AudioManager(option) {}

AudioManager.prototype.play = function (url, loop) {

    var self = this;

    /*\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u64ad\u653e*/
    if (OS.onMiniProgram) {
        var innerAudioContext = wx.createInnerAudioContext();
        innerAudioContext.autoplay = true;
        innerAudioContext.src = url;
        // innerAudioContext.onPlay = function () {
        //
        // };
        innerAudioContext.onError = function (res) {
            console.log(res);
        };
    }
    /*H5\u64ad\u653e*/
    else {

            var resBuf = this.stage.loader.getRes(url);
            if (resBuf) {
                var sourceNode = this.audioContext.createBufferSource();
                sourceNode.buffer = resBuf;
                sourceNode.loop = loop;
                sourceNode.connect(this.audioContext.destination);
                sourceNode.start(0);
                sourceNode.onended = function () {
                    // console.log('ended...')
                };
            } else {
                var loader = new Loader({
                    list: [url],
                    success: function success() {
                        self.play(url, loop);
                    }
                });
            }
        }
};

module.exports = AudioManager;

/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/6/20 0020.
 */

var Node = __webpack_require__(0);
// var Sprite = require('./Sprite');
// var React = require('./React');
// var Font = require('./Font');


module.exports = function (stage) {

    function Button(option) {
        option = option || {};
        Node.call(this, option);

        this.stage = stage;
        this.context = stage.context;

        this.text = option.text;
        this.borderImage = option.borderImage;
        this.borderMode = option.borderMode || '';

        this.round = option.round;
        this.init();
    }

    Button.prototype = new Node();

    Button.prototype.init = function () {

        if (this.borderImage) {
            this.bgNode = new this.stage.Sprite({
                texture: this.borderImage,
                drawType: this.borderMode,
                borderData: {
                    dWidth: this.width,
                    dHeight: this.height,
                    tWidth: this.borderImage.width,
                    tHeight: this.borderImage.height,
                    top: 30,
                    left: 30,
                    right: 30,
                    bottom: 30
                }
            });
        } else {
            this.bgNode = new this.stage.React({
                width: this.width,
                height: this.height,
                fillStyle: '#e1e1e1',
                round: this.round || null
            });
        }
        this.addChild(this.bgNode);

        this.textNode = new this.stage.Font({
            text: this.text,
            // overflow: '',  // auto-\u81ea\u52a8\u7f29\u653e  ellipsis multi
            maxWidth: this.width,
            maxHeight: this.height,
            lineHeight: this.height, // \u884c\u9ad8
            fillStyle: '#161616',
            // fontSize: 16,  // \u50cf\u7d20\u503c
            // font: '24px Arail',
            textAlign: 'center',
            x: this.width / 2,
            y: 0
        });
        this.addChild(this.textNode);
    };

    /*\u91cd\u65b0\u8fd9\u53ea\u80cc\u666f\u8282\u70b9*/
    Button.prototype.setBackgroundNode = function (option) {
        this.bgNode = option;
    };

    /*\u91cd\u65b0\u8bbe\u7f6e\u6587\u5b57\u8282\u70b9*/
    Button.prototype.setTextNode = function (option) {
        this.textNode = option;
    };

    Button.prototype.draw = function () {
        this.context.save();
        this.context.rect(this.x, this.y, this.width, this.height);
        this.context.clip();
        this._draw();
        this.context.restore();
    };

    return Button;
};

/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var OS = __webpack_require__(1);
/*OS\u7684\u7b80\u5355\u5224\u65ad*/
var Sprite = __webpack_require__(20);
/*\u7b80\u5355\u7684\u7cbe\u7075\u6784\u9020\u5668*/
var React = __webpack_require__(6);
/*\u7b80\u5355\u7684\u77e9\u5f62\u6784\u9020\u5668\uff0c\u517c\u5bb9\u5706\u89d2\u77e9\u5f62radius[20,20,20,10]*/
var Font = __webpack_require__(16);
/*\u7b80\u5355\u7684\u7cfb\u7edf\u5b57\u4f53\u6784\u9020\u5668*/
var Node = __webpack_require__(0);
/*\u7b80\u5355\u8282\u70b9\u7ba1\u7406*/
var Loader = __webpack_require__(2);
/*\u7b80\u5355\u7684\u8d44\u6e90\u52a0\u8f7d\u5668*/
var ListView = __webpack_require__(17);
/*\u7b80\u5355\u7684\uff08\u76ee\u524d\u53ea\u652f\u6301\u5782\u76f4\u65b9\u5411\uff09\u5217\u8868\u7684\u6784\u9020\u5668\uff0c\u81ea\u52a8\u6392\u5217\uff0c\u652f\u6301padding[20,0]*/
var ListViewItem = __webpack_require__(18);
/*\u5217\u8868\u5b50\u9879\u6784\u9020\u5668\uff0c\u5b50\u9879\u652f\u6301margin:[10,0]*/
var EventManger = __webpack_require__(15);
/*\u7b80\u5355\u7684\u4e8b\u4ef6\u7ba1\u7406\u5668*/
var ScrollView = __webpack_require__(19);
/*\u7b80\u5355\u7684\u6eda\u52a8\u89c6\u56fe*/
var Button = __webpack_require__(12);

var AudioManager = __webpack_require__(11);

var AnimationClip = __webpack_require__(5);

var Circle = __webpack_require__(14);

/**
 * \u6ca1\u6709\u5faa\u73af\u66f4\u65b0\u7ed8\u5236\uff0c\u6240\u4ee5\u9700\u8981\u624b\u52a8\u8c03\u7528update
 * \u76ee\u524d\u53ea\u9002\u7528\u5168\u5c4f\u7684\u6e38\u620f\uff08\u6ca1\u6709\u505a\u5404\u4e2a\u9002\u914d\u673a\u5236\uff09
 * @type {{}}
 * @private
 */

var audioContext = null;
var eventManager = null;

var CanvasStage = function CanvasStage(option) {

    option = option || {};
    Node.call(this, option);

    if (!audioContext) {
        audioContext = OS.onMiniProgram ? null : new window.AudioContext();
    }

    this.height = option.height;
    this.scale = option.scale || 1;
    this.width = option.width;
    this.scaleRatio = option.scaleRatio || 1;

    if (typeof option.autoRefresh !== 'undefined') {
        this.autoRefresh = option.autoRefresh;
    } else {
        this.autoRefresh = true;
        /*\u6e38\u620f\u81ea\u5faa\u73af*/
        requestAnimationFrame(this.draw.bind(this));
    }

    if (typeof option.update === 'function') {
        this.update = option.update;
    }

    if (option.id) {
        this.stageId = option.id;
        /*HTML\u4e2d\u4f20\u5165\u7684canvas ID*/
        this.canvas = document.querySelector('#' + option.id); // \u6b64\u5904\u662f\u6e32\u67d3\u7684canvas
    } else if (option.canvas) {

        this.canvas = option.canvas;
    } else {
        /*\u517c\u5bb9\u5fae\u4fe1\u7684\u521b\u5efacanvas*/
        this.canvas = OS.createCanvas();
    }

    this.context = this.canvas.getContext('2d');
    // console.log(this.context);

    this.retina = option.retina;
    this.canvas.width = this.width;
    this.canvas.height = this.height;

    /*\u7b80\u5355\u7684\u7cbe\u7075\u6784\u9020\u5668*/
    this.Sprite = Sprite(this);
    // Sprite.prototype.context = this.context;
    // Sprite.prototype.stage = this;

    /*\u7b80\u5355\u7684\u77e9\u5f62\u6784\u9020\u5668\uff0c\u517c\u5bb9\u5706\u89d2\u77e9\u5f62radius[20,20,20,10]*/
    this.React = React(this);
    // React.prototype.context = this.context;
    // React.prototype.stage = this;

    /*\u7b80\u5355\u7684\u7ed8\u5236\u5706\u5f62*/
    this.Circle = Circle(this);

    /*\u7b80\u5355\u7684\u7cfb\u7edf\u5b57\u4f53\u6784\u9020\u5668*/
    this.Font = Font(this);
    // Font.prototype.context = this.context;

    /*\u7b80\u5355\u7684\u5782\u76f4\u65b9\u5411\u5217\u8868\u7684\u6784\u9020\u5668\uff0c\u81ea\u52a8\u6392\u5217\uff0c\u652f\u6301padding*/
    this.ListView = ListView(this);
    // ListView.prototype.context = this.context;

    /*\u7b80\u5355\u7684\u5782\u76f4\u65b9\u5411\u5217\u8868\u7684\u6784\u9020\u5668\uff0c\u81ea\u52a8\u6392\u5217\uff0c\u652f\u6301padding*/
    this.Button = Button(this);
    // Button.prototype.context = this.context;

    /*\u5217\u8868\u5b50\u9879\u6784\u9020\u5668\uff0c\u5b50\u9879\u652f\u6301margin*/
    this.ListViewItem = ListViewItem(this);

    /*\u7b80\u5355\u7684\u6eda\u52a8\u89c6\u56fe*/
    this.ScrollView = ScrollView;
    ScrollView.prototype.context = this.context;
    ScrollView.prototype.stage = this;

    /*\u7b80\u5355\u7684\u8d44\u6e90\u52a0\u8f7d\u5668*/
    this.Loader = Loader;
    Loader.prototype.audioContext = audioContext;
    this.loader = new Loader();

    this.Node = Node;

    var eventManager = new EventManger({
        scaleRatio: this.scaleRatio,
        stage: this
    });
    this.EventManger = eventManager;
    EventManger.prototype.stage = this;

    this.audioManager = new AudioManager();
    AudioManager.prototype.audioContext = audioContext;
    AudioManager.prototype.stage = this;

    this.AnimationClip = AnimationClip;

    /*\u5904\u7406\u6587\u5b57\u57fa\u7ebf\uff0c\u4fee\u6539\u4e3a\u9876\u90e8*/
    this.context.setTransform(1, 0, 0, 1, 0, 0); // reset

    this.context.textBaseline = "top";

    this.context.scale(this.scale, this.scale);

    this.NODE_ID = -1;
    return this;
};

CanvasStage.prototype = new Node();

CanvasStage.prototype.createCanvas = OS.createCanvas;

/*\u68c0\u6d4b\u662f\u5426\u9700\u8981retina\u5c4f\u5e55\u8bbe\u7f6e*/
CanvasStage.prototype.checkRetinaScreen = function () {

    this.canvas.width = this.width;
    this.canvas.height = this.height;

    if (OS.onMiniProgram) {
        return;
    }

    this.canvas.style.width = this.width + 'px';
    this.canvas.style.height = this.height + 'px';

    if (this.retina === true) {
        this.canvas.width = this.width * OS.pixelRatio;
        this.canvas.height = this.height * OS.pixelRatio;
    }
};

CanvasStage.prototype.setMode = function () {

    if (!this.mode) return;

    /*\u5bf9\u5c4f\u5e55\u8fdb\u884c\u5bbd\u5ea6\u9002\u914d*/
    if (this.mode === 'fillWidth') {}

    /*\u5bf9\u5c4f\u5e55\u8fdb\u884c\u9ad8\u5ea6\u9002\u914d*/
    if (this.mode === 'fillHeight') {}
};

/**/
CanvasStage.prototype.getStageCenterPosition = function (nodeHeight) {
    return (this.height - nodeHeight * this.scale) / 2 / this.scale;
};

/*\u8bbe\u7f6e\u6682\u505c*/
CanvasStage.prototype.setPause = function (pause) {
    this.paused = pause;
};

/*\u4e3b\u8282\u70b9\u7ed8\u5236*/
CanvasStage.prototype.draw = function () {

    /*\u6e05\u9664\u753b\u5e03*/
    this.context.clearRect(0, 0, this.width, this.height);

    /*\u6e32\u67d3\u5b50\u8282\u70b9\u7684\u56fe\u50cf*/
    this._draw();

    if (!this.paused) {

        if (this.autoRefresh) {
            requestAnimationFrame(this.draw.bind(this));
        } else {
            this.update && this.update();
        }
    }
};

/*\u8bbe\u7f6e\u5706\u89d2\u7684\u88c1\u526a\u8def\u5f84\uff0c\u4e0d\u5305\u542b\u72b6\u6001\u6062\u590d\u548c\u4fdd\u5b58*/
CanvasStage.prototype.setRoundClipPath = function (x, y, width, height, round) {

    this.context.beginPath();

    var oA = { x: x, y: y };
    var oB = { x: x + width, y: y };
    var oC = { x: x + width, y: y + height };
    var oD = { x: x, y: y + height };

    /*\u79fb\u52a8\u5230\u521d\u59cb\u70b9*/
    var A = round[0];
    if (A) {
        this.context.moveTo(oA.x + A, oA.y); // \u79fb\u52a8\u5230a1
    } else {
        this.context.moveTo(oA.x, oA.y); // \u9ed8\u8ba4A
    }

    /*\u79fb\u52a8\u5230B\u70b9*/
    var B = round[1];
    if (B) {
        this.context.lineTo(oB.x - B, oB.y); // \u79fb\u52a8\u5230b1
        this.context.arcTo(oB.x, oB.y, oB.x, oB.y + B, B); // \u753b\u5706\u5f27\u5230b2
    } else {
        this.context.lineTo(oB.x, oB.y); // \u9ed8\u8ba4B
    }

    /*\u79fb\u52a8\u5230C\u70b9*/
    var C = round[2];
    if (C) {
        this.context.lineTo(oC.x, oC.y - C); // \u79fb\u52a8\u5230c1
        this.context.arcTo(oC.x, oC.y, oC.x - C, oC.y, C); //\u753b\u5706\u5f27\u5230c2
    } else {
        this.context.lineTo(oC.x, oC.y); // \u9ed8\u8ba4C
    }

    /*\u79fb\u52a8\u5230D\u70b9*/
    var D = round[3];
    if (D) {
        this.context.lineTo(oD.x + D, oD.y); // \u79fb\u52a8\u5230d1
        this.context.arcTo(oD.x, oD.y, oD.x, oD.y - D, D); //\u753b\u5706\u5f27\u5230d2
    } else {
        this.context.lineTo(oD.x, oD.y);
    }

    /*\u548cA\u95ed\u5408*/
    if (A) {
        this.context.lineTo(oA.x, oA.y + A); // \u79fb\u52a8\u5230a2
        this.context.arcTo(oA.x, oA.y, oA.x + A, oA.y, A); // \u753b\u5706\u5f27\u5230a1
    } else {
        this.context.lineTo(oA.x, oA.y);
    }
    this.context.closePath();
    this.context.clip();
};

/*\u904d\u5386\u8282\u70b9\uff0c\u6700\u597d\u4fdd\u8bc1\u4e0e\u663e\u793a(\u6e32\u67d3)\u7684\u5c42\u7ea7\u4f18\u5148\u4e00\u81f4*/
CanvasStage.prototype.traverse = function (node, callback) {
    /*\u5982\u679c\u6ca1\u6709\u4f20\u5165\uff0c\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u67e5\u627e*/
    if (!node) {
        node = this;
    }
    /*\u53ea\u904d\u5386\u663e\u793a\u7684\u8282\u70b9\u5c42*/
    if (node.visible) {
        callback && callback(node);
        var childNodes = node.childNodes;
        for (var i = 0; i < childNodes.length; i++) {
            this.traverse(childNodes[i], callback);
        }
    }
};

module.exports = CanvasStage;

/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Created by CHEN-BAO-DENG on 2018/7/3 0003.
 */

var Node = __webpack_require__(0);
module.exports = function (stage) {

    function Circle(option) {

        option = option || {};
        Node.call(this, option);

        this.r = option.r || 0;
        this.fillStyle = option.fillStyle || '#efefef'; // \u7eaf\u8272\u586b\u5145

        this.stage = stage;
        this.context = stage.context;
    }

    Circle.prototype = new Node();

    Circle.prototype.draw = function () {
        if (!this.visible) return;
        this.context.fillStyle = this.fillStyle;
        this.context.beginPath();
        this.context.arc(this.x, this.y, this.r, 0, 2 * Math.PI);
        this.context.fill();

        this._draw();
    };

    return Circle;
};

/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * \u652f\u6301\u7684\u4e8b\u4ef6\uff1atouchstart\uff0ctouchmove\uff0ctouchend\uff0ctap\uff08click\uff09
 */

var OS = __webpack_require__(1);
var _init = false,
    stageTarget = [];

function EventManger(option) {
    option = option || {};
    this.scaleRatio = option.scaleRatio || 1;
    this.stage = option.stage;
    this.targets = [];
    // INIT_EVENT.call(this);
    this.init();
}

EventManger.prototype._init = false;

/*\u7b80\u5355\u7684\u77e9\u5f62\u78b0\u649e*/
EventManger.prototype.collisionDetection = function (touchPoint, reactObject) {

    if (!reactObject.visible) return false; // \u5bf9\u9690\u85cf\u7684\u5143\u7d20\u4e0d\u8fdb\u884c\u70b9\u51fb\u5224\u65ad

    if (reactObject.x <= touchPoint.x && reactObject.x + reactObject.width >= touchPoint.x) {
        if (reactObject.y <= touchPoint.y && reactObject.y + reactObject.height >= touchPoint.y) {
            return true;
        }
    }

    return false;
};

/*\u89e6\u6478\u5f00\u59cb\u7684\u4e8b\u4ef6*/
EventManger.prototype.touchStartHandle = function (e, stage) {

    if (!stage.visible) return;
    /*\u753b\u5e03\u4e0d\u53ef\u89c1\uff0c\u4e8b\u4ef6\u65e0\u6548*/
    // var self = this;
    var touchPoint = this.getPosition(e);

    /*\u904d\u5386\u73b0\u6709\u53ef\u80fd\u70b9\u51fb\u5230\u7684target*/
    var targets = this.getCollisionNodes(touchPoint, true);

    for (var i = 0; i < targets.length; i++) {
        var _tar = targets[i];
        _tar._touchstart = touchPoint;
        this.emit(_tar, 'touchstart', touchPoint); // TOUCH_START EVENT
        if (!_tar.through) return; // \u5bf9\u7a7f\u900f\u8fdb\u884c\u5224\u65ad
    }
};

/*\u89e6\u6478\u7ed3\u675f\u7684\u4e8b\u4ef6*/
EventManger.prototype.touchEndHandle = function (e, stage) {

    // console.log('touchEndHandle', this.stage._name, stage._name);

    if (!stage.visible) return;
    var touchPoint = this.getPosition(e);
    var targets = this.getCollisionNodes(touchPoint, true);

    /*\u904d\u5386\u73b0\u6709\u7684target*/
    for (var i = 0; i < targets.length; i++) {
        var _tar = targets[i];
        this.emit(_tar, 'touchend', touchPoint); // TOUCH_END EVENT

        /*\u6a21\u62dftap\u89e6\u53d1\u4e8b\u4ef6*/
        if (_tar._touchstart) {
            // bug \u533a\u57df\u5185\u5224\u65ad
            var dT = touchPoint.timestamp - _tar._touchstart.timestamp;
            var dX = touchPoint.x - _tar._touchstart.x;
            var dY = touchPoint.y - _tar._touchstart.y;
            if (dY < 3 && dX < 3 && dT <= 200) {
                _tar._touchstart = null;
                // console.log('tap target', _tar.NODE_ID);
                this.emit(_tar, 'tap', touchPoint); // TAP EVENT
            }
        }
        if (!_tar.through) break; // \u5bf9\u7a7f\u900f\u8fdb\u884c\u5224\u65ad
    }

    this.emit(stage, 'touchend', touchPoint);
};

/*\u89e6\u6478\u79fb\u52a8\u7684\u4e8b\u4ef6*/
EventManger.prototype.touchMoveHandle = function (e, stage) {
    if (!stage.visible) return;

    var touchPoint = this.getPosition(e);
    var targets = this.getCollisionNodes(touchPoint, true);

    /*\u904d\u5386\u73b0\u6709\u7684target*/
    for (var i = 0; i < targets.length; i++) {
        var _tar = targets[i];
        this.emit(_tar, 'touchmove', touchPoint); // TAP EVENT
        if (!_tar.through) break; // \u5bf9\u7a7f\u900f\u8fdb\u884c\u5224\u65ad
    }
    this.emit(stage, 'touchmove', touchPoint);
};

EventManger.prototype.getCollisionNodes = function (touchPoint, order) {
    var self = this;
    var targets = [];

    this.stage.traverse(null, function (_tar) {
        if (self.collisionDetection(touchPoint, _tar)) {
            targets.push(_tar);
        }
    });

    if (order) {
        targets.sort(function (v1, v2) {
            return v1.NODE_ID < v2.NODE_ID;
        });

        targets.sort(function (v1, v2) {

            if (v1.zIndex < v2.zIndex) {
                return 1;
            } else if (v1.zIndex > v2.zIndex) {
                return -1;
            } else {
                return 0;
            }
        });
    }

    return targets;
};

/*\u83b7\u53d6\u5750\u6807\u503c*/
EventManger.prototype.getPosition = function (e) {

    var c = {
        left: 0,
        top: 0
    },
        p = { x: -1, y: -1 };

    if (!OS.onMiniProgram) {
        if (this.engineCanvas) {
            c = this.engineCanvas.getBoundingClientRect();
        } else {
            c = this.stage.canvas.getBoundingClientRect();
        }
    }

    switch (e.type) {
        case 'mousedown':
        case 'mousemove':
        case 'mouseup':
            // case 'click':
            p.x = e.clientX - c.left;
            p.y = e.clientY - c.top;
            break;
        case 'touchend':
        case 'touchmove':
        case 'touchstart':
        /*\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u7684\u7c7b\u578b*/
        case 'ontouchend':
        case 'ontouchmove':
        case 'ontouchstart':
            p.x = e.changedTouches[0].clientX - c.left;
            p.y = e.changedTouches[0].clientY - c.top;
            break;
        default:
            break;
    }

    p.x *= this.scaleRatio;
    p.y *= this.scaleRatio;
    p.timestamp = +new Date();

    return p;
};

/*\u4e8b\u4ef6\u521d\u59cb\u5316*/
EventManger.prototype.init = function () {

    stageTarget.push(this.stage); // \u7ed9\u4e0d\u540c\u7684stage\u5bf9\u8c61
    // console.log('push...', this.stage);

    /*\u6b64\u5904\u662f\u4e3a\u4e86\u517c\u5bb9\u5f15\u64ce\u751f\u6210\u7684canvas*/
    if (_init) {
        return;
    }
    _init = true;
    // console.log('....init.... event ....');

    if (!OS.onMiniProgram) {
        this.engineCanvas = document.querySelector('canvas'); // \u53d6\u5168\u5c40\u7684canvas
        if (this.engineCanvas) {
            if (OS.onMobile) {
                this.engineCanvas.addEventListener('touchstart', this.stageTouchStart.bind(this), false);
                this.engineCanvas.addEventListener('touchend', this.stageTouchEnd.bind(this), false);
                this.engineCanvas.addEventListener('touchmove', this.stageTouchMove.bind(this), false);
            } else {
                this.engineCanvas.addEventListener('mousedown', this.stageTouchStart.bind(this), false);
                this.engineCanvas.addEventListener('mouseup', this.stageTouchEnd.bind(this), false);
                this.engineCanvas.addEventListener('mousemove', this.stageTouchMove.bind(this), false);
            }
        }
    } else {
        /*\u76d1\u542c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u89e6\u6478\u4e8b\u4ef6  this \u662f\u521d\u59cb\u7684*/
        wx.onTouchStart(this.stageTouchStart.bind(this));
        wx.onTouchEnd(this.stageTouchEnd.bind(this));
        wx.onTouchMove(this.stageTouchMove.bind(this));
    }
};

EventManger.prototype.stageTouchStart = function (e) {
    /*\u5faa\u73af\u8c03\u7528\u4e8b\u4ef6*/
    for (var i = 0; i < stageTarget.length; i++) {
        this.touchStartHandle.bind(stageTarget[i].EventManger)(e, stageTarget[i]);
    }
};

EventManger.prototype.stageTouchEnd = function (e) {
    /*\u5faa\u73af\u8c03\u7528\u4e8b\u4ef6*/
    for (var i = 0; i < stageTarget.length; i++) {
        this.touchEndHandle.bind(stageTarget[i].EventManger)(e, stageTarget[i]);
    }
};

EventManger.prototype.stageTouchMove = function (e) {
    /*\u5faa\u73af\u8c03\u7528\u4e8b\u4ef6*/
    for (var i = 0; i < stageTarget.length; i++) {
        this.touchMoveHandle.bind(stageTarget[i].EventManger)(e, stageTarget[i]);
    }
};

EventManger.prototype.destroyEvent = function (stage) {
    for (var i = 0; i < stageTarget.length; i++) {
        if (stageTarget[i] === stage) {
            stageTarget.splice(i, 1);
            return;
        }
    }
};

EventManger.prototype.addStageEvent = function (stage) {};

/*\u89e6\u53d1\u4e8b\u4ef6*/
EventManger.prototype.emit = function (target, type, args) {
    if (target[type]) {
        target[type](args);

        /*\u79fb\u9664\u4e00\u6b21\u6027\u7684\u4e8b\u4ef6*/
        if (target[type + '-once']) {
            target[type] = null;
        }
    }
};

module.exports = EventManger;

/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Node = __webpack_require__(0);

/**
 * overflow(\u9700\u8981\u914d\u5408maxWidth) : auto-\u81ea\u52a8\u7f29\u653e  ellipsis-\u8d85\u51fa\u90e8\u5206\u7701\u7565\u53f7  multi-\u81ea\u52a8\u6362\u884c
 * @param stage
 * @constructor
 */

module.exports = function (stage) {

    function Font(option) {
        option = option || {};
        Node.call(this, option);

        var self = this;

        this.stage = stage;
        this.context = stage.context;

        Object.defineProperty(this, 'overflow', {
            set: function set(key, value) {
                self.preCheck(key);
            }
        });

        this._text = option.text; // \u539f\u59cb\u7684\u5b57\u7b26\u4e32
        this.fillStyle = option.fillStyle;
        this._fontSize = option.fontSize || 16;
        this.maxWidth = option.maxWidth;
        this.maxHeight = option.maxHeight;
        this.lineHeight = option.lineHeight || this._fontSize;
        this.textAlign = option.textAlign || 'left';
        this.overflow = option.overflow;
    }

    Font.prototype = new Node();

    /*\u53d8\u66f4\u6587\u5b57\u7684\u663e\u793a*/
    Font.prototype.preCheck = function (type) {

        this.height = this._fontSize;
        this.width = this._text.length * this._fontSize;
        this.fontSize = this._fontSize;
        this.text = this._text;
        this.multiTextArray = null; // \u9ed8\u8ba4\u6ca1\u6709\u591a\u884c\u663e\u793a

        if (!this.maxWidth) return;
        this.width = this.maxWidth;

        var singleText = this.maxWidth / this.fontSize >> 0;

        /*\u81ea\u52a8\u7f29\u653e\u6587\u5b57\u5927\u5c0f\uff0c\u5355\u6392\u663e\u793a*/
        if (type === 'auto') {
            var fontSize = this.maxWidth / this.text.length >> 0;
            this.fontSize = fontSize;
            this.height = fontSize;
        }

        /*\u8d85\u51fa\u90e8\u5206\u7528\u7701\u7565\u53f7\u4ee3\u66ff*/
        else if (type === 'ellipsis') {
                this.text = this._text.substring(0, singleText - 1) + '...';
            }

            /*\u591a\u884c\u663e\u793a*/
            else if (type === 'multi') {
                    var multi = Math.ceil(this._text.length / singleText);
                    this.multiTextArray = [];
                    for (var i = 0; i < multi; i++) {
                        var y = i * this.lineHeight;
                        this.multiTextArray.push({
                            text: this._text.substring(i * singleText, singleText + i * singleText),
                            x: 0,
                            y: y
                        });
                        this.height = y + this.lineHeight;
                    }
                }

                /*\u9ed8\u8ba4\u7684*/
                else {
                        this.text = this._text.substring(0, singleText);
                    }
    };

    Font.prototype.draw = function () {
        if (!this.visible) return;
        this.context.fillStyle = this.fillStyle;
        this.context.font = this.fontSize + 'px arial';
        this.context.textAlign = this.textAlign;

        var offsetY = (this.lineHeight - this.fontSize) / 2;

        /*\u591a\u884c\u6587\u5b57\u7684\u663e\u793a*/
        if (this.multiTextArray) {
            for (var i = 0; i < this.multiTextArray.length; i++) {
                var singleText = this.multiTextArray[i];
                this.context.fillText(singleText.text, singleText.x + this.x, singleText.y + this.y + offsetY);
            }
        }

        /*\u5355\u884c\u6587\u5b57\u7684\u663e\u793a*/
        else {
                this.context.fillText(this.text, this.x, this.y + offsetY);
            }

        this._draw();
    };

    return Font;
};

/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Node = __webpack_require__(0);
// var React = require('./React');
module.exports = function (stage) {

    function ListView(option) {
        option = option || {};

        Node.call(this, option);

        this.stage = stage;
        this.context = stage.context;

        this.background = option.background;
        this.padding = option.padding;

        if (this.padding) {
            this.height += this.padding[0] + this.padding[2];
        }

        if (this.background) {
            this.backgroundReact = new stage.React({
                fillStyle: this.background,
                width: this.width,
                height: this.height,
                x: this.x,
                y: this.y,
                round: [0, 0, 32, 32]
            });
            this.backgroundReact.hasComputed = false;
            // this.addChild()
        }

        /*\u521b\u5efa\u4e00\u4e2a\u80cc\u666f\u77e9\u5f62*/
    }

    ListView.prototype = new Node();

    ListView.prototype.addChild = function (node) {
        /*\u68c0\u67e5\u53ea\u80fd\u6dfb\u52a0ListViewItem*/
        // if (node.constructorName !== "ListViewItem") {
        //     return console.log("ListView \u53ea\u80fd\u6dfb\u52a0 ListViewItem \u7c7b\u578b");
        // }
        if (!node.NODE_ID) {
            node.NODE_ID = node.getNODE_ID();
        }
        node.parentNode = this;
        this.childNodes.push(node);
        this.computedChildPosition(node); // \u91cd\u65b0\u8ba1\u7b97\u5b50\u8282\u70b9\u7684\u4f4d\u7f6e
    };

    ListView.prototype.computedChildPosition = function (node) {

        node.x += this.x; // \u521d\u59cb\u7684\u4f4d\u7f6e
        node.y += this.y; // \u521d\u59cb\u7684\u4f4d\u7f6e

        /*\u8282\u70b9\u5b9a\u4e49*/
        var currentLength = this.childNodes.length;
        if (currentLength === 1) {
            node.previousSibling = null;
        } else {
            node.previousSibling = this.childNodes[currentLength - 2];
            this.childNodes[currentLength - 1].nextSibling = node;
        }

        /*\u8ba1\u7b97\u81ea\u8eab\u7684y*/
        if (node.previousSibling) {
            node.y = node.previousSibling.y + node.offsetBottom + node.previousSibling.height; // \u4e0a\u4e00\u4e2a
        }

        /*\u8ba1\u7b97\u81ea\u8eab\u7684x*/
        node.x += node.offsetLeft;
        node.y += node.offsetTop;

        var nodeHeight = node.offsetTop + node.height + node.offsetBottom;
        this.height += nodeHeight;

        if (this.backgroundReact) {
            this.backgroundReact.height = this.height;
        }
    };

    ListView.prototype.draw = function () {

        if (!this.visible) return;

        if (this.backgroundReact) {
            if (this.parentNode && !this.backgroundReact.hasComputed) {
                // bug \u52a0\u5165hasComputed
                this.backgroundReact.x += this.parentNode.x;
                this.backgroundReact.y += this.parentNode.y;
                this.backgroundReact.hasComputed = true;
            }
            this.backgroundReact.draw();
        }

        this._draw();
    };

    return ListView;
};

/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Node = __webpack_require__(0);

module.exports = function (stage) {

    function ListViewItem(option) {
        option = option || {};

        Node.call(this, option);

        // if(option.margin){
        this.margin = option.margin || [];

        this.stage = stage;
        this.context = stage.context;
        // }

        this.computedPosition();
        // this.constructorName = "ListViewItem";
    }

    ListViewItem.prototype = new Node();

    ListViewItem.prototype.getIndex = function () {
        if (this.parentNode) {
            var pList = this.parentNode.childNodes;
            for (var i = 0; i < pList.length; i++) {
                if (pList[i] === this) {
                    return i;
                }
            }
        }

        return -1;
    };

    /*\u91cd\u65b0\u8ba1\u7b97\u5f53\u524d\u7684\u4f4d\u7f6e*/
    ListViewItem.prototype.computedPosition = function () {

        var _TOP = this.margin[0],
            _BOTTOM = this.margin[2],
            _LEFT = this.margin[3],
            _RIGHT = this.margin[1];

        /*TOP*/
        if (typeof _TOP === 'number') {
            this.offsetTop = _TOP;
        } else {
            this.offsetTop = 0;
        }

        /*BOTTOM*/
        if (typeof _BOTTOM === 'number') {
            this.offsetBottom = _BOTTOM;
        } else {
            this.offsetBottom = 0;
        }

        /*LEFT*/
        if (typeof _LEFT === 'number') {
            this.offsetLeft = _LEFT;
        } else if (_LEFT === "auto") {
            this.offsetLeft = (this.parentNode.width - this.width) / 2;
        } else {
            this.offsetLeft = 0;
        }
    };

    return ListViewItem;
};

/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Node = __webpack_require__(0);
var React = __webpack_require__(6);
var AnimationClip = __webpack_require__(5);

/**
 * \u7b80\u5355\u7684\u6eda\u52a8\u89c6\u56fe\u529f\u80fd
 * @constructor
 */
var Z_INDEX = 100;

function ScrollView(option) {
    option = option || {};
    Node.call(this, option);
    this.zIndex = Z_INDEX++; // \u4f18\u5148\u5904\u7406\u4e8b\u4ef6\u8282\u70b9
    this.scrollTop = 0; // \u6eda\u52a8\u7684\u8ddd\u79bb
    this.maxScrollTop = 0;
    this.contenHeight = 0;
    this.addDefaultNode();
}

ScrollView.prototype = new Node();

/*\u91cd\u6784\u6dfb\u52a0\u7684\u51fd\u6570*/
ScrollView.prototype.addChild = function (node) {
    this._addChild(node);
    /*\u6b64\u5904\u9488\u5bf9ScrollView\u505a\u5904\u7406*/
    if (this.scrollContainer) {
        this.scrollContainer.childNodes.push(node);
        // this.contenHeight = this.getContentHeight();  // \u91cd\u65b0\u8ba1\u7b97\u9ad8\u5ea6

        /*\u6dfb\u52a0\u4e8b\u4ef6*/
        if (!this._initEvent) {
            this._initEvent = true;
            this.addEvent();
        }

        /*\u6dfb\u52a0\u6eda\u52a8\u52a8\u753b*/
        if (!this._initAnimationClip) {
            this._initAnimationClip = true;
            var aniClip = new AnimationClip({}, {
                duration: 120,
                forwards: true
            });
            this.scrollContainer.addAnimationClip('scroll', aniClip);
        }
    } else this.childNodes.push(node);
};

/*\u6dfb\u52a0\u9ed8\u8ba4\u7684\u8282\u70b9*/
ScrollView.prototype.addDefaultNode = function () {

    var scrollContainer = new Node({
        through: false
    });
    this.addChild(scrollContainer);

    /*\u6dfb\u52a0\u4e8b\u4ef6\u7684\u906e\u7f69\u5c42*/
    var mask = new React({
        width: this.width,
        height: this.height,
        fillStyle: 'rgba(0,0,0,0)',
        through: false
    });
    this.addChild(mask);

    this.scrollContainer = scrollContainer;
};

/*\u6dfb\u52a0\u76f8\u5e94\u7684\u4e8b\u4ef6*/
ScrollView.prototype.addEvent = function () {
    var self = this;
    self.touchStartPoint = null;
    self.touchMovePoint = null;
    self.touchEndPoint = null;

    this.on('touchstart', function (e) {
        self.through = true;
        self.touchStartPoint = e;
        self.touchStartPoint.startY = self.scrollContainer.y; // \u521d\u59cb\u7684\u8282\u70b9
    });

    /*\u5bf9\u6574\u4e2a\u6e38\u620f\u753b\u5e03\u8fdb\u884c\u76d1\u542c*/
    this.stage.on('touchmove', function (e) {
        if (!self.touchStartPoint) return;
        self.through = false;
        self.touchMovePoint = e;
        var delY = self.touchMovePoint.y - self.touchStartPoint.y;
        self.scrollContainer.setPosition(self.x, self.touchStartPoint.startY + delY);
    });

    this.stage.on('touchend', function (e) {
        self.through = true;
        if (!self.touchStartPoint) return;

        self.scrollTop = self.scrollContainer.y; // \u5bb9\u5668\u7684\u6eda\u52a8\u8ddd\u79bb

        /*\u5411\u4e0a\u6eda\u52a8*/
        if (self.scrollTop < 0) {

            if (self.scrollTop < -self.maxScrollTop) {
                var clip = self.scrollContainer.getAnimationClip('scroll');
                if (clip) {
                    clip.setClipValue({
                        x: self.x,
                        y: -self.maxScrollTop
                    });
                    clip.start();
                }
            } else {
                /*\u7f13\u52a8\u52a8\u753b*/
                /**
                 * \u7f13\u52a8\u4ee3\u7801
                 */
                console.log('\u7f13\u52a8\u4ee3\u7801');
            }
        }

        /*\u5411\u4e0b\u6eda\u52a8*/
        else if (self.scrollTop > 0) {

                var clip = self.scrollContainer.getAnimationClip('scroll');
                if (clip) {
                    clip.setClipValue({
                        x: self.x,
                        y: self.y
                    });
                    clip.start();
                }
            }

        self.touchStartPoint = null;
        self.touchMovePoint = null;
    });
};

/*\u6eda\u52a8\u7ec4\u4ef6\u7684\u81ea\u66f4\u65b0*/
ScrollView.prototype.update = function () {
    this.computedContentHeight();
};

/**
 * \u83b7\u53d6\u6eda\u52a8\u5185\u5bb9\u7684\u9ad8\u5ea6\uff08\u6709\u4e00\u5b9a\u7684bug\u54e6\uff09\uff0c\u4ee5\u53ca\u6548\u7387\u95ee\u9898
 */
ScrollView.prototype.computedContentHeight = function () {

    var contents = this.scrollContainer.childNodes;
    if (contents.length === 0) {
        return 0;
    }

    var height = 0,
        itemHeight = 0;
    for (var i = 0; i < contents.length; i++) {
        itemHeight = contents[i].y + contents[i].height;
        if (itemHeight > height) {
            height = itemHeight;
        }
    }

    height -= this.scrollContainer.y;
    this.maxScrollTop = height - this.height; // \u6700\u5927\u53ef\u6eda\u52a8\u7684\u9ad8\u5ea6\uff0c\u7528\u4e8e\u8fb9\u754c\u5224\u65ad
    this.contenHeight = height;
};

ScrollView.prototype.draw = function () {
    if (!this.visible) return;
    var context = this.context;

    /*\u521b\u5efa\u526a\u8f91\u533a\u57df*/
    context.save();
    context.beginPath();
    context.rect(this.x, this.y, this.width, this.height);
    context.clip();
    this._draw();
    context.restore();
};

module.exports = ScrollView;

/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*\u7b80\u5355\u7684\u7cbe\u7075\u6784\u9020*/

var Node = __webpack_require__(0);
var Loader = __webpack_require__(2);
var OS = __webpack_require__(1);

module.exports = function (stage) {

    function Sprite(option) {

        option = option || {};
        Node.call(this, option);

        this.stage = stage;
        this.context = stage.context;

        this.drawType = option.drawType || '';

        /*\u4e5d\u5bab\u683c\u7c7b\u578b*/
        this.borderData = option.borderData || null;
        if (this.borderData && this.drawType === 'sliced') {
            this.borderData = this.getBorderData(this.borderData);
        }

        /*\u5706\u89d2\u7c7b\u578b*/
        this.round = option.round || [];
        if (this.round.length && this.drawType === 'round') {}

        if (option.texture) {
            this.setTexture(option.texture);
        } else if (option.url) {
            this.setUrl(option.url, { width: this.width, height: this.height });
        }
    }

    Sprite.prototype = new Node();

    /*\u8bbe\u7f6e\u5355\u4e2a\u8d34\u56fe\u7684\u56fe\u50cf*/
    Sprite.prototype.setTexture = function (texture, option) {
        option = option || {};
        this.texture = texture;
        this.width = option.width || texture.width;
        this.height = option.height || texture.height;
        // console.log('setTexture', this.parentNode);
        // if (this.parentNode && this.parentNode.constructorName === "ListViewItem") {
        //     // this.parentNode.computedPosition();  // \u901a\u77e5\u66f4\u65b0\u5c3a\u5bf8
        // }
    };

    /*\u8bbe\u7f6e\u5355\u4e2a\u8d34\u56fe\u7684\u56fe\u50cf\u8def\u5f84*/
    Sprite.prototype.setUrl = function (url, option) {
        option = option || {};
        this.texture = null; // \u6e05\u9664\u4e4b\u524d\u7684\u8d34\u56fe
        this.url = url;
        this.loadTexture(option);
    };

    /*\u52a0\u8f7d\u5355\u4e2a\u8d34\u56fe*/
    Sprite.prototype.loadTexture = function (option) {
        option = option || {};
        var self = this;
        var loader = new Loader({
            list: [this.url],
            success: function success(res) {
                var texture = loader.getRes(self.url);
                self.setTexture(texture, option);
                /*\u901a\u77e5stage\u91cd\u65b0\u7ed8\u5236\uff08\u5982\u679c\u6ca1\u6709\u81ea\u52a8\u66f4\u65b0\u7684\u8bdd\uff09*/
                self.stage.draw();
            }
        });
    };

    /*\u8ba1\u7b97\u4e5d\u5bab\u683c\u56fe\u7247\u7684\u88c1\u526a\u4f4d\u7f6e*/
    Sprite.prototype.getBorderData = function (data) {
        data = data || {};
        var avgWidth = data.tWidth / 3;
        var avgHeight = data.tHeight / 3;
        data.right = data.right || avgWidth;
        data.left = data.left || avgWidth;
        data.top = data.top || avgHeight;
        data.bottom = data.bottom || avgHeight;

        var top = data.top,
            left = data.left,
            right = data.right,
            bottom = data.bottom;
        var mClipWidth = data.tWidth - left - right,
            mDrawWidth = data.dWidth - left - right;
        var mClipHeight = data.tHeight - top - bottom,
            mDrawHeight = data.dHeight - top - bottom;

        /*\u88c1\u526a\u7684\u70b9\u884c-\u5217*/
        var CC0 = 0,
            CC1 = left,
            CC2 = data.tWidth - right,
            CR0 = 0,
            CR1 = top,
            CR3 = data.tHeight - bottom;

        /*\u7ed8\u5236\u7684\u70b9\u884c-\u5217*/
        var DC0 = 0,
            DC1 = left,
            DC2 = data.dWidth - right,
            DR0 = 0,
            DR1 = top,
            DR2 = data.dHeight - bottom;

        var A = { cx: CC0, cy: CR0, cw: left, ch: top, dx: DC0, dy: DR0, dw: left, dh: top };
        var B = { cx: CC1, cy: CR0, cw: mClipWidth, ch: top, dx: DC1, dy: DR0, dw: mDrawWidth, dh: top };
        var C = { cx: CC2, cy: CR0, cw: right, ch: top, dx: DC2, dy: DR0, dw: right, dh: top };

        var D = { cx: CC0, cy: CR1, cw: left, ch: mClipHeight, dx: DC0, dy: DR1, dw: left, dh: mDrawHeight };
        var E = { cx: CC1, cy: CR1, cw: mClipWidth, ch: mClipHeight, dx: DC1, dy: DR1, dw: mDrawWidth, dh: mDrawHeight };
        var F = { cx: CC2, cy: CR1, cw: right, ch: mClipHeight, dx: DC2, dy: DR1, dw: right, dh: mDrawHeight };

        var G = { cx: CC0, cy: CR3, cw: left, ch: bottom, dx: DC0, dy: DR2, dw: left, dh: bottom };
        var H = { cx: CC1, cy: CR3, cw: mClipWidth, ch: bottom, dx: DC1, dy: DR2, dw: mDrawWidth, dh: bottom };
        var I = { cx: CC2, cy: CR3, cw: right, ch: bottom, dx: DC2, dy: DR2, dw: right, dh: bottom };

        data.drawList = [A, B, C, D, E, F, G, H, I];
        return data;
    };

    /*\u91cd\u6784\u7ed8\u5236\u51fd\u6570*/
    Sprite.prototype.draw = function () {
        if (!this.visible) return;

        if (this.texture) {
            /*\u6839\u636e\u4e0d\u540c\u7684\u6e32\u67d3\u7c7b\u578b\uff0c\u8fdb\u884c\u6e32\u67d3*/
            if (this.drawType === 'sliced' && this.borderData) {
                // \u4e5d\u5bab\u683c\u7ed8\u5236
                for (var i = 0; i < this.borderData.drawList.length; i++) {
                    var item = this.borderData.drawList[i];
                    this.context.drawImage(this.texture, item.cx, item.cy, item.cw, item.ch, item.dx + this.x, item.dy + this.y, item.dw, item.dh);
                }
            }

            /*\u5706\u89d2\u77e9\u5f62*/
            else if (this.drawType === 'round' && this.round) {
                    this.context.save();
                    this.stage.setRoundClipPath(this.x, this.y, this.width, this.height, this.round);
                    this.context.drawImage(this.texture, this.x, this.y, this.width, this.height);
                    this.context.restore();
                }

                /*\u9ed8\u8ba4\u7684\u6e32\u67d3*/
                else {
                        this.context.drawImage(this.texture, this.x, this.y, this.width, this.height);
                    }
        }

        this._draw();
    };

    return Sprite;
};

/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var Tween = {
    Linear: function Linear(t, b, c, d) {
        return c * t / d + b;
    },
    Quad: {
        easeIn: function easeIn(t, b, c, d) {
            return c * (t /= d) * t + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return -c * (t /= d) * (t - 2) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t + b;
            return -c / 2 * (--t * (t - 2) - 1) + b;
        }
    },
    Cubic: {
        easeIn: function easeIn(t, b, c, d) {
            return c * (t /= d) * t * t + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return c * ((t = t / d - 1) * t * t + 1) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
            return c / 2 * ((t -= 2) * t * t + 2) + b;
        }
    },
    Quart: {
        easeIn: function easeIn(t, b, c, d) {
            return c * (t /= d) * t * t * t + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return -c * ((t = t / d - 1) * t * t * t - 1) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
            return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
        }
    },
    Quint: {
        easeIn: function easeIn(t, b, c, d) {
            return c * (t /= d) * t * t * t * t + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
            return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
        }
    },
    Sine: {
        easeIn: function easeIn(t, b, c, d) {
            return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return c * Math.sin(t / d * (Math.PI / 2)) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
        }
    },
    Expo: {
        easeIn: function easeIn(t, b, c, d) {
            return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if (t == 0) return b;
            if (t == d) return b + c;
            if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
            return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
        }
    },
    Circ: {
        easeIn: function easeIn(t, b, c, d) {
            return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
            return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
        }
    },
    Elastic: {
        easeIn: function easeIn(t, b, c, d, a, p) {
            var s;
            if (t == 0) return b;
            if ((t /= d) == 1) return b + c;
            if (typeof p == "undefined") p = d * .3;
            if (!a || a < Math.abs(c)) {
                s = p / 4;
                a = c;
            } else {
                s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        },
        easeOut: function easeOut(t, b, c, d, a, p) {
            var s;
            if (t == 0) return b;
            if ((t /= d) == 1) return b + c;
            if (typeof p == "undefined") p = d * .3;
            if (!a || a < Math.abs(c)) {
                a = c;
                s = p / 4;
            } else {
                s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
        },
        easeInOut: function easeInOut(t, b, c, d, a, p) {
            var s;
            if (t == 0) return b;
            if ((t /= d / 2) == 2) return b + c;
            if (typeof p == "undefined") p = d * (.3 * 1.5);
            if (!a || a < Math.abs(c)) {
                a = c;
                s = p / 4;
            } else {
                s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
            return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
        }
    },
    Back: {
        easeIn: function easeIn(t, b, c, d, s) {
            if (typeof s == "undefined") s = 1.70158;
            return c * (t /= d) * t * ((s + 1) * t - s) + b;
        },
        easeOut: function easeOut(t, b, c, d, s) {
            if (typeof s == "undefined") s = 1.70158;
            return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
        },
        easeInOut: function easeInOut(t, b, c, d, s) {
            if (typeof s == "undefined") s = 1.70158;
            if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
            return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
        }
    },
    Bounce: {
        easeIn: function easeIn(t, b, c, d) {
            return c - Tween.Bounce.easeOut(d - t, 0, c, d) + b;
        },
        easeOut: function easeOut(t, b, c, d) {
            if ((t /= d) < 1 / 2.75) {
                return c * (7.5625 * t * t) + b;
            } else if (t < 2 / 2.75) {
                return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;
            } else if (t < 2.5 / 2.75) {
                return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;
            } else {
                return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;
            }
        },
        easeInOut: function easeInOut(t, b, c, d) {
            if (t < d / 2) {
                return Tween.Bounce.easeIn(t * 2, 0, c, d) * .5 + b;
            } else {
                return Tween.Bounce.easeOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
            }
        }
    }
};
module.exports = Tween;

/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*
* \u66f4\u65b0\u65e5\u5fd7:
*
*
* 2018-7-11:
* [add] \u5206\u4eab\u7684\u53c2\u6570\u643a\u5e26\u5206\u4eab\u8005ID,\u4f18\u5148\u8bfb\u53d6\u542f\u52a8\u53c2\u6570\u4e2d\u7684channel,ajax\u4e0a\u62a5\u7684\u65f6\u5019\u5e26\u4e0a\u5206\u4eab\u5206ID\u7528\u4e8e\u7edf\u8ba1;
* [add] sdk.getLaunchQuery(),\u8fd4\u56de\u5c0f\u6e38\u620f\u7684\u542f\u52a8\u53c2\u6570\u5bf9\u8c61;
*
*
*
* */

var MD5 = __webpack_require__(4);
var sdwAd = __webpack_require__(10);
var Ajax = __webpack_require__(7);
var Rank = __webpack_require__(9);
var Payment = __webpack_require__(8);
var OS = __webpack_require__(1);
var objectFormat = __webpack_require__(3);

var SDWMiniSDK = function SDWMiniSDK(option) {

    option = option || {};

    if (!option.wxAppId) {
        return console.log('\u8bf7\u586b\u5165\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684ID\uff08\u8bf7\u767b\u5f55\u5fae\u4fe1\u540e\u53f0\u67e5\u770b\uff09');
    }

    if (!option.channel) {
        return console.log('\u8bf7\u586b\u5165channel\uff08\u95ea\u7535\u73a9\u5e73\u53f0\u63d0\u4f9b\u7684\u6e20\u9053ID\uff09');
    }

    if (!option.appId) {
        return console.log('\u8bf7\u586b\u5165appId\uff08\u95ea\u7535\u73a9\u5e73\u53f0\u63d0\u4f9b\u7684\u6e38\u620fID\uff09');
    }

    var app = this;
    var wxAppId = option.wxAppId; // \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684ID
    var channel = option.channel; // \u5e73\u53f0\u7684\u6e20\u9053\u503c
    var appId = option.appId; // \u95ea\u7535\u73a9\u5e73\u53f0ID

    app.useSdw = option.useSdw; // \u662f\u5426\u4f7f\u7528

    app.isMiniProgram = typeof wx !== 'undefined'; // \u6b64\u5904\u9700\u8981\u5224\u65ad\u662f\u5426\u5728\u5fae\u4fe1\u5c0f\u6e38\u620f\u73af\u5883\u4e2d(\u7b80\u5355\u5224\u65ad\uff0c\u53ef\u80fd\u6709bug)
    app.onMiniProgram = app.isMiniProgram;
    if (app.isMiniProgram) {
        app.isGame = typeof wx.createCanvas !== 'undefined';
    }

    app.storeKey = 'sdw_user';

    app.getWxAppId = function () {
        return wxAppId;
    };
    app.getChannel = function () {
        return channel;
    };
    app._setChannel = function (channelid) {
        channel = channelid;
    };
    app.getAppId = function () {
        return appId;
    };

    app.createGUI = function (length) {
        var S4 = function S4() {
            return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
        };
        var keyItem = 'SDW_GUID',
            GUI = '';

        // var GUI = this.Store.get(keyItem, true) || '';
        // if (app.isMiniProgram) {
        try {
            GUI = wx.getStorageSync(keyItem) || '';
        } catch (e) {}
        // }

        if (GUI.length != 32) {
            GUI = '';
            for (var i = 0; i < length; i++) {
                GUI += S4();
            } // this.Store.set(keyItem, GUI, true);
            try {
                wx.setStorageSync(keyItem, GUI);
            } catch (e) {}
        }

        return GUI;
    };

    app.HTTP_USER_STATIC = 'https://auth.shandw.com/';
    app.HTTP_PLATFORM_STATIC = 'https://platform.shandw.com/';

    app.md5 = MD5;
    app.wxUserInfo = null;
    app.userCallback = null;
    app.successUserCallback = [];
    app.failUserCallback = [];
    app.checkState = 0; // \u8bb0\u5f55\u5e73\u53f0\u7528\u6237\u6821\u9a8c\u7684\u72b6\u6001\uff0c\u9ed8\u8ba4\u662f\u5931\u8d25

    if (OS.onMiniProgram) {
        var _wxGetUserInfo = function _wxGetUserInfo() {
            // wx.getUserInfo({
            //     lang: 'zh_CN',
            //     // withCredentials: true,
            //     success: res => {
            //         app.wxUserInfo = res.userInfo;
            //         console.log('wx.getUserInfo[success]', res);
            //         if (app.userCallback) {
            //             _login();
            //         }
            //     }, fail: res => {
            //         console.log('wx.getUserInfo[fail]', res);
            //         app.getUserInfoFlag = true;
            //         if (app.userCallback) {
            //             _login();
            //         }
            //     }
            // });
            app.getUserInfoFlag = true;
        };

        // \u83b7\u53d6\u7528\u6237\u4fe1\u606f


        // \u5982\u4e0b\u529f\u80fd\u53ea\u5728\u5c0f\u6e38\u620f\u4e2d\u624d\u4f1a\u5b9e\u73b0
        if (app.isGame) {

            // \u5982\u679c\u662f\u5728\u6e38\u620f\u4e2d\uff0c\u901a\u8fc7onShow\u5237\u65b0\u65b0\u7684\u542f\u52a8\u53c2\u6570
            wx.onShow(function (res) {
                // console.log('wx.onShow', res);
                app._wx_launchs = res;
                if (app._wx_launchs.query && app._wx_launchs.query.channel) {
                    channel = app._wx_launchs.query.channel;
                }
                // \u6bcf\u6b21\u540e\u53f0\u542f\u52a8\u5c31\u6821\u9a8c\u7528\u6237\u4fe1\u606f-\u4e0a\u62a5\u7edf\u8ba1\u4f5c\u7528
                if (app._USER_INFO) {
                    app.fastCheckUserInfo(app._USER_INFO);
                }
            });

            // \u83b7\u53d6\u542f\u52a8\u53c2\u6570
            try {
                if (wx.getLaunchOptionsSync) {
                    app._wx_launchs = wx.getLaunchOptionsSync();
                    // \u91cd\u65b0\u8986\u76d6channel\u503c
                    if (app._wx_launchs.query && app._wx_launchs.query.channel) {
                        channel = app._wx_launchs.query.channel;
                    }
                }
            } catch (e) {
                // \u83b7\u53d6\u5931\u8d25
                console.log('getLaunchOptionsSync:', e);
            }
        }

        // \u83b7\u53d6\u624b\u673a\u8bbe\u5907\u4fe1\u606f
        try {
            app.wxSystem = wx.getSystemInfoSync();
            // console.log(app.wxSystem);
            app.onMiniProgram = true;
            if (/ios/ig.test(app.wxSystem.system)) {
                app.wxSystem.OS = 2; // IOS:2
            } else {
                app.wxSystem.OS = 1;
            }
            /*\u6dfb\u52a0\u50cf\u7d20\u5206\u8fa8\u7387*/
            app.CLIENT = {
                width: this.wxSystem.windowWidth * this.wxSystem.pixelRatio,
                height: this.wxSystem.windowHeight * this.wxSystem.pixelRatio,
                pixelRatio: this.wxSystem.pixelRatio
            };
        } catch (e) {
            // Do something when catch error
        }

        _wxGetUserInfo();

        // \u83b7\u53d6\u672c\u5730\u7f13\u5b58\u7684\u7528\u6237\u6570\u6570\u636e
        try {
            var value = wx.getStorageSync(app.storeKey);
            if (value) {
                app.storeInfo = value; // \u5b58\u50a8\u7684\u6570\u636e
            } else {}
        } catch (e) {}
    } else {

        var width = document.documentElement.clientWidth || document.body.clientWidth;
        var height = document.documentElement.clientHeight || document.body.clientHeight;
        var pixelRatio = window.devicePixelRatio || 1;

        /*\u6dfb\u52a0\u50cf\u7d20\u5206\u8fa8\u7387*/
        app.CLIENT = {
            width: width * pixelRatio,
            height: height * pixelRatio,
            pixelRatio: pixelRatio
        };

        /*\u975e\u5fae\u4fe1 \u6dfb\u52a0 \u5b50\u9875\u9762\u7684\u6d88\u606f\u76d1\u542c\u4e8b\u4ef6\u7528\u4e8e\u8fd4\u56de*/
        window && window.addEventListener && window.addEventListener('message', function (e) {
            // console.log('SDWMiniSDK:[e.data]', e.data);
            if (typeof e.data === 'string') {
                try {
                    var postData = JSON.parse(e.data);
                    if (postData.postSdwData) {
                        var type = postData.operate;
                        var userData = postData.data;
                        // \u7528\u6237\u4fe1\u606f\u56de\u8c03
                        // console.log('type:[e]', type);
                        if (type === 'sdwMiniSDK_getSDWUserInfo_callback') {
                            if (userData.uid) {
                                userData.appid = app.getAppId(); // \u8fd4\u56de\u5e73\u53f0id
                                userData.channel = app.getChannel(); // \u8fd4\u56de\u5e73\u53f0\u7684\u6e20\u9053\u503c
                                app.checkState = 2; // \u6821\u9a8c\u6210\u529f
                                app._USER_INFO = userData;
                                app.emitCallback('success', userData);
                            } else {
                                app.emitCallback('fail', { msg: '\u7528\u6237\u4fe1\u606f\u83b7\u53d6\u5931\u8d25' });
                            }
                        }
                    }
                } catch (e) {
                    console.log(e);
                }
            }
        }, false);

        /*\u81ea\u52a8\u6ce8\u5165sdw.js*/
        app.JS_LOADED_CALLBACK = [];

        if (option.useSdw) {
            var addJsFile = function addJsFile(url, success, error) {
                var oHead = document.getElementsByTagName('HEAD').item(0);
                var oScript = document.createElement("script");
                oScript.type = "text/javascript";
                oScript.src = url;
                oHead.appendChild(oScript);
                oScript.onload = function () {
                    typeof success === 'function' && success();
                };
                oScript.onerror = function () {
                    typeof error === 'function' && error();
                };
            };
            addJsFile('https://www.shandw.com/libs/js/sdwJs.min.js?v=' + +new Date(), function () {

                app.sdw = sdw; // \u8fdb\u884c\u6302\u8f7d

                addJsFile('https://pay.17m3.com/gamepay/dhpay.min.js?v=' + +new Date(), function () {
                    app.JS_LOADED = true;
                    // \u5168\u90e8\u6210\u529f\u540e
                    app.JS_LOADED_CALLBACK.forEach(function (callback) {
                        callback();
                    });
                    app.JS_LOADED_CALLBACK = [];
                }, function () {
                    console.log('load dhpay.js fail.');
                });
            }, function () {
                console.log('load sdwJs.js fail.');
            });
        } else {

            app.JS_LOADED = true;
        }
    }

    app.CLIENT.pixelRatio = Math.max(2, app.CLIENT.pixelRatio);

    /*\u7f51\u7edc\u8bf7\u6c42\u6a21\u5757*/
    Ajax(app);
    /*\u6392\u884c\u699c\u6570\u636e\u76f8\u5173\u63a5\u53e3*/
    Rank(app);
    /*\u95ea\u7535\u73a9\u652f\u4ed8\u6a21\u5757*/
    if (app.isGame) app.chooseSDWPay = Payment(app);

    /**
     * \u5feb\u901f\u89e6\u53d1\u56de\u8c03\u4e8b\u4ef6
     * @param type
     * @param data\uff08\u7528\u6237\u7684\u57fa\u672c\u6570\u636e\u4fe1\u606f\uff09
     */
    app.emitCallback = function (type, data, save) {
        // \u5728\u5fae\u4fe1\u5c0f\u6e38\u620f\u73af\u5883\u4e2d\uff0c\u53ef\u80fd\u5b58\u5728\u542f\u52a8\u53c2\u6570\uff0c\u9700\u8981\u8fd4\u56de\u8ffd\u52a0\u4fe1\u606f
        if (app._wx_launchs) {
            var launchs = app._wx_launchs;
            data.wxScene = launchs.scene; // \u5c0f\u6e38\u620f\u573a\u666f\u542f\u52a8\u503c
            if (launchs.referrerInfo && launchs.referrerInfo.extraData) {
                data.wxExtraData = launchs.referrerInfo.extraData;
            }
            data.wxQuery = launchs.query;
            data.wxIsSticky = launchs.isSticky;
        }

        app[type + 'UserCallback'].forEach(function (callback) {
            callback(data);
        });

        // console.log( app[type + 'UserCallback']);
        // console.log(type,'forEach...');

        if (!save) {
            // console.log(type,'clearCallback...');
            app[type + 'UserCallback'] = [];
        }
    };

    /**
     * \u5feb\u901f\u9a8c\u8bc1\u5f53\u524d\u7684\u7528\u6237\u4fe1\u606f\u662f\u5426\u6b63\u786e\uff08\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff09
     * @param userInfo
     * @param success
     * @param fail
     */
    app.fastCheckUserInfo = function (userInfo, success, fail) {

        var data = {
            channel: userInfo.channel,
            gid: app.getAppId(), // \u5e73\u53f0\u6e38\u620f\u7684ID
            uid: userInfo.uid,
            openid: userInfo.openid,
            token: userInfo.token,
            sec: userInfo.secheme
        };

        app.getData(app.HTTP_USER_STATIC + 'wxjsverify', data, function (res) {
            if (res.result === 1) {
                userInfo.time = res.time;
                userInfo.sign = res.sign;
                success && success();
                // \u4e0a\u62a5\u5206\u4eab\u4fe1\u606f
                app.uploadShareInfo({
                    eventType: 1
                });
            } else {
                fail && fail();
            }
        });
    };

    var _login = function _login() {
        if (app.storeInfo) {
            // \u8fdb\u884c\u7528\u6237\u6821\u9a8c
            app._USER_INFO = app.storeInfo; // SDK\u5168\u5c40\u4fdd\u5b58\u7528\u6237\u4fe1\u606f
            if (app.checkState === 0) {
                app.checkState = 1; // \u6b63\u5728\u6821\u9a8c\u4e2d
                app.fastCheckUserInfo(app.storeInfo, function () {
                    app.checkState = 2; // \u6821\u9a8c\u6210\u529f
                    app.emitCallback('success', app.storeInfo);
                }, function () {
                    app.checkState = 0; // \u6821\u9a8c\u5931\u8d25
                    app.storeInfo = null;
                    try {
                        wx.removeStorageSync(app.storeKey);
                    } catch (e) {
                        // Do something when catch error
                    }
                    app.getAuthInfo();
                });
            } else if (app.checkState === 2) {
                // \u6821\u9a8c\u6210\u529f\u540e\uff0c\u76f4\u63a5\u8fd4\u56de
                app.emitCallback('success', app.storeInfo);
            }
        } else if (app.getUserInfoFlag) {
            app.emitCallback('fail', { msg: 'wx.getUserInfo[fail]\uff1a\u83b7\u53d6\u5fae\u4fe1\u7528\u6237\u4fe1\u606f\u5931\u8d25', code: -1 }, true);
        } else if (app.wxUserInfo) {
            app._sdwGetLogin();
        } else {
            app.userCallback = true;
        }
    };

    app.reAuth = function (data) {
        app.wxUserInfo = data;
        app.getUserInfoFlag = false;
        _login();
    };

    /*\u83b7\u53d6\u7528\u6237\u4fe1\u606f\uff0c\u4fdd\u6301\u4e0esdw web \u63a5\u53e3\u4e00\u81f4*/
    app.getAuthInfo = function (option, ignore) {

        option = option || {};
        // \u4fdd\u5b58
        if (option.success) {
            app.successUserCallback.push(option.success);
        }
        if (option.fail) {
            app.failUserCallback.push(option.fail);
        }

        // web \u5411\u7236\u7ea7\u9875\u9762\u53d1\u9001\u8bf7\u6c42\u6d88\u606f
        if (!app.isMiniProgram) {
            // console.log('sdwMiniSDK_getSDWUserInfo.....PostMessage');
            if (window.parent !== window) {
                window.parent.postMessage(JSON.stringify({
                    postSdwData: true,
                    operate: 'sdwMiniSDK_getSDWUserInfo'
                }), '*');
            } else {

                /*\u4e0d\u5728iframe\u4e2d*/
                app.emitCallback('fail', { msg: "[SDK\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5931\u8d25]\uff1a\u5f53\u524d\u4f7f\u7528\u73af\u5883\u662fH5\u73af\u5883\uff0c\u5e76\u4e0d\u5728\u95ea\u7535\u73a9\u7684\u6e38\u620f\u5e73\u53f0\u4e2d" });
            }
            return;
        }

        /*\u5c0f\u6e38\u620f\u4f7f\u7528\u652f\u4ed8\uff0c\u6545\u8fdb\u884csession_key\u7684\u6821\u9a8c*/
        if (app.isGame) {
            wx.checkSession({
                success: function success() {
                    console.log('session_key:check ok');
                    _login();
                },
                fail: function fail() {
                    console.log('session_key:check fail');
                    app.checkState = 0; // \u6821\u9a8c\u5931\u8d25
                    app.storeInfo = null; // \u6e05\u9664\u672c\u5730\u7684\u95ea\u7535\u73a9\u7528\u6237\u4fe1\u606f
                    try {
                        wx.removeStorageSync(app.storeKey);
                    } catch (e) {
                        // Do something when catch error
                    }
                    _login(); // \u91cd\u65b0\u6267\u884c\u767b\u5f55\u6d41\u7a0b
                }
            });
        } else {
            /*\u5c0f\u7a0b\u5e8f\u76ee\u524d\u6ca1\u6709\u8fdb\u884csession\u7684\u6821\u9a8c*/
            _login();
        }
    };

    // \u8c03\u7528\u767b\u5f55\u63a5\u53e3
    app._sdwGetLogin = function () {

        var dataObj = {};
        dataObj.appid = app.getWxAppId();
        dataObj.channel = app.getChannel();

        if (!app.wxUserInfo) {
            app.emitCallback('fail', { msg: 'wx.getUserInfo[fail]\uff1a\u83b7\u53d6\u5fae\u4fe1\u7528\u6237\u4fe1\u606f\u5931\u8d25', code: -1 });
            return;
        }

        dataObj.nickName = app.wxUserInfo.nickName;
        dataObj.avatarUrl = app.wxUserInfo.avatarUrl;
        dataObj.city = app.wxUserInfo.city;
        dataObj.country = app.wxUserInfo.country;
        dataObj.gender = app.wxUserInfo.gender;
        dataObj.province = app.wxUserInfo.province;
        dataObj.os = app.wxSystem.OS;

        wx.login({
            success: function success(res) {
                dataObj.jscode = res.code;

                app.getData(app.HTTP_USER_STATIC + 'wxjsauth/', dataObj, function (data) {
                    if (data.result === 1) {
                        data.avatar = data.avatar || app.wxUserInfo.avatarUrl;
                        data.avatarUrl = data.avatar;
                        data.uid = data.id;
                        /*\u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u8f6c\u6362\u52a0\u5bc6
                         userInfo.secheme = +new Date();
                        userInfo.token = MD5('' + this.channel + userInfo.uid + userInfo.secheme + userInfo.otoken);*/
                        data.otoken = data.token;
                        data.secheme = +new Date();
                        data.token = app.md5('' + dataObj.channel + data.uid + data.secheme + data.otoken);
                        data.imei = app.createGUI(8); // imei
                        data.channel = dataObj.channel;
                        data.wxopenid = data.openid; // \u5fae\u4fe1\u7684openid
                        data.os = app.wxSystem.OS;
                        data.appid = app.getAppId();
                        // \u7f13\u5b58\u7528\u6237\u7684\u4fe1\u606f\u6570\u636e
                        wx.setStorage({
                            key: app.storeKey,
                            data: data
                        });
                        app._USER_INFO = data;
                        app.checkState = 2;
                        app.emitCallback('success', data);
                        // \u521b\u89d2
                        if (data.isNew == 1) {
                            app.uploadShareInfo({
                                eventType: 2
                            });
                        } else {
                            app.uploadShareInfo({
                                eventType: 1
                            });
                        }
                    } else {
                        app.emitCallback('fail', data);
                    }
                });
            },

            // \u83b7\u53d6code\u503c\u5931\u8d25
            fail: function fail(res) {
                app.emitCallback('fail', { msg: 'wx.login[fail]\uff1a\u83b7\u53d6\u5fae\u4fe1code\u503c\u5931\u8d25' });
            }

        });
    };

    var setShareQuery = function setShareQuery(option) {
        option.query = option.query || '';
        if (!app._USER_INFO) {
            return;
        }

        var senderId = 'sdwrfid=' + app._USER_INFO.uid;
        if (option.query) {
            option.query += '&' + senderId;
        } else {
            option.query = senderId;
        }
        if (typeof option.shareId !== 'undefined') {
            option.query += '&shareId=' + option.shareId;
        }
        // console.log('shareInfo', option);
    };

    function reSetShareOption(option) {
        var share = {};
        for (var i in option) {
            if (option.hasOwnProperty(i)) {
                if (typeof option[i] !== 'function') {
                    share[i] = option[i];
                }
            }
        }
        if (option.success) {
            share.success = function (res) {
                // \u4e0a\u62a5\u5206\u4eab\u4fe1\u606f
                app.uploadShareInfo({
                    shareId: option.shareId
                });
                option.success(res);
            };
        }
        if (option.fail) {
            share.fail = function (res) {
                option.fail(res);
            };
        }
        return share;
    }

    /**
     * \u8bbe\u7f6e\u5206\u4eab
     * @param option
     */
    app.onSetShareOperate = function () {
        var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

        option = option || {};
        setShareQuery(option); // \u91cd\u65b0\u8bbe\u7f6e
        var share = reSetShareOption(option);
        // console.log('share:', share);
        if (option.target) {
            // \u5c0f\u7a0b\u5e8f\u7684\u8bbe\u7f6e target \u8868\u793a\u9875\u9762Page
            option.target.onShareAppMessage = function (res) {
                // setShareQuery(option);
                app.uploadShareInfo({
                    shareId: share.shareId,
                    eventType: 3
                });
                if (share.path.indexOf('?') !== -1) {
                    share.path += '&' + share.query;
                } else {
                    share.path += '?' + share.query;
                }
                return share;
            };
        } else {
            wx.showShareMenu(); // \u9ed8\u8ba4\u4e0d\u5c55\u793a\uff0c\u9700\u8981\u5f00\u542f\u8f6c\u53d1
            // \u5c0f\u6e38\u620f\u7684\u5206\u4eab\u8bbe\u7f6e
            if (option.fastShare) {
                // setShareQuery(option);
                app.uploadShareInfo({
                    shareId: share.shareId,
                    eventType: 3
                });
                wx.shareAppMessage(share);
            } else {
                wx.onShareAppMessage(function () {
                    // setShareQuery(option);
                    app.uploadShareInfo({
                        shareId: share.shareId,
                        eventType: 3
                    });
                    return share;
                });
            }
        }
    };

    /*\u83b7\u53d6\u542f\u52a8\u53c2\u6570*/
    app.getLaunchQuery = function (all) {
        /*https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html*/
        /*scene\u573a\u666f\u503c  \u57fa\u7840\u5e932.2.4   1011\u6211\u7684\u5c0f\u7a0b\u5e8f   1089\u6211\u6700\u8fd1\u4f7f\u7528*/
        if (!app._wx_launchs) return {};
        if (all) {
            return app._wx_launchs;
        }
        return app._wx_launchs.query;
    };

    // \u4f7f\u7528H5\u7684sdw.js   http://www.shandw.com/sdwdoc/template/sdwdoc.html
    // \u5982\u679c\u91c7\u7528\u6b64SDK\u63a5\u5165\u7684\u8bdd\uff0c\u4e3a\u4e86\u517c\u5bb9\u4e4b\u524dH5\u7684sdw\u65b9\u6cd5\uff08\u5176\u4ed6\u7684\u9664\u4e86\u5fae\u4fe1\uff09\uff0c\u51cf\u5c11CP\u7684\u5224\u65ad\uff0c\u4e4b\u524dsdw[type](args)\u7684\u5199\u6cd5\u5168\u90e8\u6539\u6210
    // app.use_H5_sdw(type,args);
    // sdw.requestFullScreen()    ==>   app.use_H5_sdw('requestFullScreen')
    // sdw.chooseSDWPay(payData)  ==>   app.use_H5_sdw('chooseSDWPay',payData)
    app.use_H5_sdw = function () {

        if (!option.useSdw) {
            console.log('\u5982\u679c\u60f3\u8981\u4f7f\u7528use_H5_sdw\uff0c\u8bf7\u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u914d\u7f6euseSdw\u53c2\u6570');
            return;
        }

        var type = arguments[0];
        var args = Array.prototype.slice.apply(arguments);

        var clk = function clk() {
            sdw[type] && sdw[type].apply(sdw, args.splice(1));
        };

        // \u4f7f\u7528H5\uff0c\u539f\u5148\u7684sdw\u7684\u65b9\u6cd5
        if (app.JS_LOADED && typeof sdw !== 'undefined') {
            clk();
        } else {
            app.JS_LOADED_CALLBACK.push(clk);
        }
    };

    if (app.isGame) {
        app.sdwAd = sdwAd(app); // \u91c7\u7528Canvas\u6e32\u67d3\u5173\u6ce8\u516c\u4f17\u53f7\u7684\u76f8\u5173\u5185\u5bb9
    }

    /*\u5e7f\u544aID\uff0c\u6ca1\u6709\u5219\u586b\u5199\u5e73\u53f0\u7684ID*/
    app.getSdwAdInfo = function (option) {
        option = option || {};
        var postData = {
            appid: option.id || app.getAppId(),
            sec: +new Date()
        };
        var oS = '' + postData.appid + postData.sec + 'D60CADF1A41C651E1F0ADE50136BAD43';
        postData.sign = app.md5(oS);
        app.getData(app.HTTP_PLATFORM_STATIC + 'tinyadc', postData, function (res) {
            if (res.result === 1) {
                // \u5bf9\u5e8f\u5217\u5e27\u505a\u5904\u7406
                if (res.home) {
                    if (res.home.img) {
                        res.home.img = res.home.img.split(',');
                    }
                }
                option.success && option.success(res);
            } else {
                option.fail && option.fail(res);
            }
        });
    };

    /*\u8df3\u8f6c\u5230\u95ea\u7535\u73a9*/
    app.goToSdw = function (option) {
        option = option || {};

        option.data = option.data || {};

        // \u6839\u636e\u4e0b\u53d1\u7684\u4fe1\u606f\uff0c\u6253\u5f00\u5c0f\u6e38\u620f
        var openObj = {
            appId: option.appId || 'wxdc1767838b33cbdb', // \u95ea\u7535\u73a9\u6e38\u620f\u5e73\u53f0\u7684\u5fae\u4fe1ID
            path: 'pages/main/main'
        };

        option.data.sdwfrom = app.getWxAppId(); // \u6765\u6e90

        if (option.path) {
            openObj.path = option.path;
        }

        var pStr = objectFormat(option.data, true);

        if (openObj.path.indexOf('?') === -1) {
            openObj.path += '?' + pStr;
        } else {
            openObj.path += '&' + pStr;
        }

        if (option.envVersion) {
            openObj.envVersion = option.envVersion;
        }

        wx.navigateToMiniProgram(openObj);
    };

    /*\u4e0a\u62a5\u5206\u4eab\u7684\u884c\u4e3a\u6570\u636e*/
    app.uploadShareInfo = function (option) {
        option = option || {};
        var query = app.getLaunchQuery();
        var shareId = option.shareId || query.shareId; // \u5206\u4eab\u6587\u6848id
        var uid = app._USER_INFO ? app._USER_INFO.uid : -1;
        if (typeof shareId === 'undefined' || uid === -1) return;
        var postData = {
            shareId: shareId,
            uid: uid,
            appId: app.getAppId(),
            /**
             * 0\uff1a\u7528\u6237\u5206\u4eab\u6210\u529f\uff08\u6210\u529f\u5206\u4eab\u6b21\u6570\uff09
             * 1\uff1a\u5206\u4eab\u8fdb\u5165\uff0c\u7528\u6237\u767b\u5f55\uff08\u5206\u4eab\u70b9\u51fb\uff0c\u975e\u65b0\u7528\u6237\uff09
             * 2\uff1a\u5206\u4eab\u8fdb\u5165\uff0c\u7528\u6237\u521b\u89d2\uff08\u5206\u4eab\u70b9\u51fb\uff0c\u5168\u65b0\u7528\u6237\uff09
             * 3\uff1a\u5524\u8d77\u5206\u4eab\u754c\u9762\uff08\u8c03\u7528\u5206\u4eab\u6b21\u6570\uff09
             */
            eventType: option.eventType || 0
        };
        app.getData('https://sttc.shandw.com/shareupload', postData, function (res) {});
    };
};

module.exports = SDWMiniSDK;

/***/ })
/******/ ]);